begin
if parm2 is not null
select * from tab
where tab.col1=parm1
and tab.col2=parm2
;
else
select * from tab
where tab.col1=parm1;
end;
if parm2 is not null
select * from tab
where tab.col1=parm1
and tab.col2=parm2
;
else
select * from tab
where tab.col1=parm1;
end;
解决方案 »
- 使用Toad 进行Health Check时出现下面的问题,请问如何优化?
- oracle同义词求助!谢谢
- 问一下触发器的sqlcode判断问题
- 触发器的奇怪问题
- 请教一下oracle存储过程中拆分字符串的函数?
- 如何获取一个字符串里某个字符的位置呢
- oracle怎么创建方案?
- 能否给点有关用JOB定期执行ANASYLE的源码,还希望各位指教呀。
- oracle9i客户盘装好后,出现奇怪错误,热心人快帮忙啊!
- 各位csdn的xdjm,跪求oracle数据库问题,在线等,给分不是问题
- 数据库重新启动后改变了作业原先设定好的执行时间,作业时间会变成数据库启动的那个时间,请各位不吝赐教
- 如何在存储过程中调用由字符串描述的存储过程?急等!
..
if parm2 is not null
condition = and tab.col2=parm2;
else condition = '';
...
select * from tab
where tab.col1=parm1||' '||condition
嘿嘿,不晓得可不可以。。
is
begin
if lenght(parm2)<>0 then
select * from tab
where tab.col1=parm1 and tab.col2=parm2;
else
select * from tab
where tab.col1=parm1 and tab.col2=parm2;
end if;
end;
else
select * from tab
where tab.col1=parm1 and tab.col2=parm2; 改为: else
select * from tab
where tab.col1=parm1 ;
where (p_a is null or t.a = p_a)
and (p_b is null or t.b = p_b)