本帖最后由 lrl1286219215 于 2011-11-16 16:46:49 编辑

解决方案 »

  1.   

    begin
      if (1=1) then 
         dbms_output.put_line('select * from tableName');
      else
         dbms_output.put_line('select * from tableName1');
      end if;
    end;
      

  2.   

    在程式里写成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;