我创建了一个变量IDS TABLECLIENT.ID&type;
,并使用以下内容填充该变量:
OPEN V_ID;
LOOP
FETCH V_ID INTO IDS;
EXIT WHEN V_ID%NOTFOUND;
END LOOP;
CLOSE V_ID;
它存储了5个id客户端,但是当我在select语句中使用它时,我等待了5个寄存器,但是我只得到了1:
SELECT *
FROM TABLECLIENT
WHERE ID IN IDS;
也许我必须在语句中循环id?请帮助oracle的朋友
1条答案
按热度按时间js4nwp541#
IDS
-在某一时刻-只包含游标读取的一行。例如,这是Scott示例模式中的部门表:
这段代码模拟了你所拥有的(尽管,如果你发布了这些信息会更好);游标选择部门编号,然后在另一个查询中使用该值。
结果为: