I currently have two fairly long select statements, identical apart from the fact that the first is looking to see if the row exists via count(*) and the second selecting the row into the rowtype variable based on an if statement. This is because the data is required for further manipulation
I know it is possible, but I am having a complete brainfreeze and google returns lots of information about select, and if/else but not branching based on select.
I've tried wrapping the select in an if statements and failed so I was wondering what else there is to try.
Update: Psuedo-example:
select count(*) into num_items where <very long operation>;
if (num_items = 1) then
begin
select * into row_item where <very long operation>;
end;
else
dbms_output.put_line('failure');
end if;
Also: On a slightly unrelated note, how do you get the dbms_output to flush immeadiately so you can see where the script is currently up to? At the moment it only prints once the script has ended.
Thanks.