select * from talbe1 t where t.fcode is null;select * from talbe1 t where t.fcode not in('a','b','c');
把not in 换成is not null
现在的情况是这样的, 在一个游标里, cursor c(s in varchar) is select * from talbe1 t where t.fcode not in s;其中,传入的s值可以是 ('') ,也可能是 ('a','b','c') 当传入('')时表示的是可以忽略t.fcode not in s这个条件,这种怎么处理呀
select m.num from tpickup m where m.num = '001' and decode('a', null, '1 = 1', 'cd');我写的这条语句,编译的时候总是报错, 告诉我ORA-00920:无效的关系运算符。哪位大虾指点一把呀
create or replace procedure optiontest is vs varchar2(255); vs2 varchar2(255); vs3 varchar2(255); begin vs := 'abc'; if vs is null then vs := '1 = 1'; else vs := 'm.fname not in ' || vs; end if;
select m.num into vs2 from tpickup m where m.fcode = 001' and vs; if vs2 is null then Dbms_Output.put_line('选项是空的'); else Dbms_Output.put_line('选项里有值的'); end if; end;这么写也编译不过去
where t.fcode is null;select * from talbe1 t
where t.fcode not in('a','b','c');
在一个游标里,
cursor c(s in varchar) is
select * from talbe1 t
where t.fcode not in s;其中,传入的s值可以是 ('') ,也可能是 ('a','b','c')
当传入('')时表示的是可以忽略t.fcode not in s这个条件,这种怎么处理呀
where m.num = '001' and decode('a', null, '1 = 1', 'cd');我写的这条语句,编译的时候总是报错,
告诉我ORA-00920:无效的关系运算符。哪位大虾指点一把呀
vs varchar2(255);
vs2 varchar2(255);
vs3 varchar2(255);
begin
vs := 'abc';
if vs is null then
vs := '1 = 1';
else
vs := 'm.fname not in ' || vs;
end if;
select m.num into vs2 from tpickup m
where m.fcode = 001' and vs;
if vs2 is null then
Dbms_Output.put_line('选项是空的');
else
Dbms_Output.put_line('选项里有值的');
end if;
end;这么写也编译不过去