begin if (1=1) then dbms_output.put_line('select * from tableName'); else dbms_output.put_line('select * from tableName1'); end if; end;
在程式里写成pl/sql就可以了,refcursor作为传出参数 declare x number; type refcursortype is ref cursor; refcursor refcursortype; begin x:=0; if x=1 then open refcursor for select * from dual; else open refcursor for select count(*) from dual; end if; end;
if (1=1) then
dbms_output.put_line('select * from tableName');
else
dbms_output.put_line('select * from tableName1');
end if;
end;
declare
x number;
type refcursortype is ref cursor;
refcursor refcursortype;
begin
x:=0;
if x=1 then
open refcursor for select * from dual;
else
open refcursor for select count(*) from dual;
end if;
end;