Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: hopefully easy SQL question
You could try a refcursor:
variable rc_myprint
begin
... your code ...
if mycondition then
open :rc_myprint for select cola,colb,colc from mytab;
else
open :rc_myprint for select colb,colc from mytab;
end if;
end;
/
ttitle etc...
print rc_myprint