Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: extracting records using a cursor within a cursor
swoop wrote:
> Hi,
>
> I have managed to correct my error on the SQL statement to get it
> working, so thanks very much for your help. It has updated my TGBPAYM
> table wit the required records.
>
> However, I have been asked to do it using cursors as I will need to add
> more to it later as this is just the start. If someone could
> point/guide me as to where I have gone wrong with it and would really
> appreciate it.
>
> I have made some changes to it but not sure if it's the right
> direction.
You would still only need ONE cursor, which would look something like this:
DECLARE
CURSOR c IS
SELECT CMPY, SUPP, ENTRY_DATE, SYSREF
FROM tgbtran t
WHERE tran_type = 1
AND ordr_rltd_flag = 'Y' AND yy = 2005
where p.cmpy = t.cmpy and p.supp = t.supp and p.trans_entry_date = t.entry_date and p.trans_sysref = t.sysref);