Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Referring to cursor values with dot notation
A PL/SQL cursor must be explicitely FETCHed into program variable(s) for its values to become available to the PL/SQL block. Extending your example, the "complete"PL/SQL block would look like:
DECLARE
LOOP -- Fetch required to retrieve values FETCH c INTO my_row; -- Exit if cursor exhaust EXIT WHEN c%NOTFOUND; -- Now we can insert... INSERT INTO table2(field1, field2) VALUES(my_row.field1, my_row.field2); -- Note field references END LOOP;
-- Done, clean up
CLOSE c;