【发布时间】:2017-11-26 05:31:45
【问题描述】:
我的部分程序是这样的:
declare
v_cnt_1 number;
v_cnt_2 number;
begin
with input1 as(
select .........
from...
where.....)
select count(*) into v_cnt_1
from input1 t
where......);
with input2 as(
select .........
from...
where.....)
select count(*) into v_cnt_2
from input2 t
where......);
IF v_cnt_1 >0 or v_cnt_2 >0
THEN DBMS_OUTPUT.PUT_LINE('all set');
ELSE DBMS_OUTPUT.PUT_LINE('take further action');
end if;
end;
我的目标是:如果此查询返回“采取进一步行动”的结果,那么我必须实施其他步骤,如果有进一步的 if/else 语句。如果返回“采取进一步行动”,我还有四种情况(if/else)要添加。如何在此输出的基础上添加 if/else?还是我需要创建另一个过程并在新过程中调用这个过程?
【问题讨论】:
标签: sql oracle if-statement stored-procedures plsql