create global temporary table T_TEMP (field1 number);Then you can use it and dynamic SQL to get what you want.
declare nretval number := 0; cSQL varchar2(2000); begin cSQL := 'truncate table T_TEMP'; execute immediate cSQL; cSQL := 'insert into T_TEMP (select sum( case when 1 = 1 and 2 = 2 then 5 else 6 end) from dual)'; execute immediate cSQL; select field1 into nretval from T_TEMP; dbms_output.put_line('Value: ' || to_char(nretval)); end;Determine upfront what you want to store and create a temp table using that structure. Once you have the results, you can use a cursor to go through all the values (if more than one) and do whatever processing you want.
> sum( case > when z = 123 and y = 432 > then 'hello World' > end) as SomeTotal >>So I guess my question is How can I get around this?