Dba_admin, in your code you should (IMHO) do the following:
- declare your cursor explicitely, so that it has a name
- use that named cursor in your cursor-for-loop
- use cursor_name%ROWCOUNT attribute to find out if it is the first record returned
Something like that:
Code:
DECLARE
CURSOR my_cur IS
SELECT column_name FROM user_tab_columns
WHERE table_name=UPPER('&1');
BEGIN
FOR rec IN my_cur LOOP
IF my_cur%ROWCOUNT = 1 THEN
----------------
ELSE
----------------
END IF;
END LOOP;
---------------
END;
I think this is much more readable and elegant than using inline view inside the implicitly declared cursor.
To see if the currently returned record is the last record in the resultset? No, you can't tell that in advance, not from inside the cursor.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?