Hi,
I need to have a conditional cursor, like:
- If a row exists (using WHEN EXISTS or something like this), then my cursor is:
- CURSOR varCursor IS SELECT 1 a FROM DUAL;
- Else
- CURSOR varCursor IS SELECT 2 a FROM DUAL;
But look, I don't want to change a column result, I want to change the entire cursor.
Bellow I put a bigger example.
Thanks!
See:
SET serveroutput ON SIZE 900000;
DECLARE
CURSOR varCursor IS SELECT 1 a FROM DUAL;
-- CURSOR varCursor IS SELECT 2 a FROM DUAL;
BEGIN
FOR varRow IN varCursor LOOP
dbms_output.put_line('row: ' || varRow.a);
END LOOP;
dbms_output.put_line('Done.');
END;