表T中数据如下:
A B
1 a
2 b
7 e
存储过程如下:
create or replace procedure test is
cursor v_cur_6(ids varchar2) is
select * from T where to_char(A) not in (ids);
v_cur_line_6 v_cur_6%ROWTYPE;
begin
open v_cur_6('1,2');
loop fetch v_cur_6 into v_cur_line_6;
exit when v_cur_6%notfound;
dbms_output.put_line('---------');
end loop;
close v_cur_6;
end;
希望的结果,通过游标参数ids过滤掉部分数据,可是我发现这样写所有数据都会出来,为什么呢,应该1、2行的数据被过滤掉啊,帮我看看原因,谢谢各位
A B
1 a
2 b
7 e
存储过程如下:
create or replace procedure test is
cursor v_cur_6(ids varchar2) is
select * from T where to_char(A) not in (ids);
v_cur_line_6 v_cur_6%ROWTYPE;
begin
open v_cur_6('1,2');
loop fetch v_cur_6 into v_cur_line_6;
exit when v_cur_6%notfound;
dbms_output.put_line('---------');
end loop;
close v_cur_6;
end;
希望的结果,通过游标参数ids过滤掉部分数据,可是我发现这样写所有数据都会出来,为什么呢,应该1、2行的数据被过滤掉啊,帮我看看原因,谢谢各位
依照你的条件可以写成
create or replace procedure test is
cursor v_cur_6(ids varchar2) is
select * from T where to_char(A) not in ('1,2');
...........
........
字符串"1,2"被视为一个元素,由于字段里没有这个元素,所以全部记录会出来