Following example You can adapt:
Good luck!
Regards,
Vera
DECLARE
CURSOR ro_cursor IS
select RO_ID, RO_GST_ID, RO_SP_VG_ID, RO_SP_REL, RO_VKKZ_ID
from table1
where ro_kz = 'N'
FOR UPDATE OF RO_VKKZ_ID;
V_VK VARCHAR2(2);
BEGIN
FOR ro_rec IN ro_cursor LOOP
V_VK := '';
V_VK := F_IS_SERVICE(ro_rec.RO_SP_VG_ID, ro_rec.RO_SP_REL);
dbms_output.put_line('VK: '||V_VK);
IF(V_VK IN ('A','C','E','I','R')) Then
UPDATE table1
SET RO_VKKZ_ID = (select VK_ID from VERKEHRS_ART
WHERE VK_KZ = V_VK)
WHERE CURRENT OF ro_cursor;
END IF;
END LOOP;
commit;
END;
/
-----Ursprüngliche Nachricht-----
Von: Rajesh [mailto:oracledba-ezmlmshield-x96604467.[Email address protected]
Gesendet: Freitag, 29. Juli 2005 07:04
An: LazyDBA Discussion
Betreff: PL/SQL procedure
Hi DBA Gurus and developers,
I have a procedure that retrieves tablename(eg:-table1) from a table .
Based on that value(table name) I have to fetch the data from another table
(eg:-table1)
It retrieves more than one row, so I have to use a cursor. ALso I have to
update that table with a value.
So, should I use ref cursor? if yes, how to do that? then while declaring
cursor should I give for update clause?
Please help me
Thanks in advance
Regards,
Raj
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com To unsubscribe: see
http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com By using this list you agree to
these terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page