select * from a where a.custid like '%%' 这样就可以显示全部数据了
select * from tb where 1=1 或 select * from tb where nvl(custid,'') like '%%'
这些动态取数,用procedure比较好,你想加多少个条件都得,如下:v_where:='1=1';if @a is not null then v_where:=v_where || ' and tb.a='||@a;end ifif @b is not null then v_where:=v_where || ' and tb.b='||@b; end if ... ..........select * from tb where ||v_where
这些动态取数,用procedure比较好,你想加多少个条件都得,如下:v_where:='1=1';if @a is not null then v_where:=v_where || ' and tb.a='||@a;end ifif @b is not null then v_where:=v_where || ' and tb.b='||@b; end if ... ..........select * from tb where ||v_where
灵活的取值,就用变量来替换,可以写一个带输入参数的过程
where a.custid like '%%'
这样就可以显示全部数据了
或
select * from tb where nvl(custid,'') like '%%'
v_where:=v_where || ' and tb.a='||@a;end ifif @b is not null then
v_where:=v_where || ' and tb.b='||@b;
end if
...
..........select * from tb where ||v_where
v_where:=v_where || ' and tb.a='||@a;end ifif @b is not null then
v_where:=v_where || ' and tb.b='||@b;
end if
...
..........select * from tb where ||v_where