我如何使用plsql像'a','b','c'那样转换'a,b,c',因为在我的过程中我需要进行一个使用“ in”的“ where”,但是调用程序时我无法通过'a','b','c'
我的程序在下面
using System.Collections.Generic;
using UnityEngine;
[AddComponentMenu("Camera-Control/Mouse Look")]
public class MouseLook : MonoBehaviour
{
public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityX = 15F;
public float sensitivityY = 15F;
public float minimumX = -360F;
public float maximumX = 360F;
public float minimumY = -60F;
public float maximumY = 60F;
float rotationY = 0F;
void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
float turnAngleChange = (touch.deltaPosition.x / Screen.width) * sensitivityX;
float pitchAngleChange = (touch.deltaPosition.y / Screen.height) * sensitivityY;
// Handle any pitch rotation
if (axes == RotationAxes.MouseXAndY || axes == RotationAxes.MouseY)
{
rotationY = Mathf.Clamp(rotationY + pitchAngleChange, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0f);
}
// Handle any turn rotation
if (axes == RotationAxes.MouseXAndY || axes == RotationAxes.MouseX)
{
transform.Rotate(0f, turnAngleChange, 0f);
}
}
void Start()
{
//if(!networkView.isMine)
//enabled = false;
// Make the rigid body not change rotation
//if (rigidbody)
//rigidbody.freezeRotation = true;
}
}
}
答案 0 :(得分:0)
可能您可以使用类似
with data as
(select 'a,b,c' col
from dual)
select regexp_substr(col, '[^,]+', 1, level) result
from data
connect by level <= length(regexp_replace(col, '[^,]+')) + 1;
上面将产生输出-
RESULT
a
b
c
这就是您可以在IN
查询中使用的内容
答案 1 :(得分:0)
如果我了解这种情况的正确性,则需要构建一个函数,以在SQL语句的WHERE子句中使用。一种方法是使用流水线表函数,查看您的代码,我想您知道这是什么。
因此,您需要将'a,b,c'转换为包含值'a','b'和'c'的数组。这可以通过WHILE循环,SUBSTR和INSTR来完成。
CREATE FUNCTION convert_for_in(p_string IN VARCHAR2)
RETURN <TableType of VARCHAR(1)> PIPELINED IS
BEGIN
FOR no_chr IN 1 .. (LENGTH (p_string) + 1) / 2 LOOP
PIPE_ROW (SUBSTR(p_string, 2 * no_chr - 1, 1);
END LOOP;
END;
并添加到WHERE子句
AND ... IN (SELECT * from table (convert_for_in('a,b,c')))
有帮助吗?
答案 2 :(得分:0)
谢谢,我可以解决我的问题 留下来了: 选择regexp_substr(P_CLASE,'[^,] +',1,level)结果 从DUAL 按级别连接<= length(regexp_replace(P_CLASE,'[^,] +'))+ 1