Page 1 of 1

Cursors

Posted: Tue Apr 10, 2007 5:46 am
by sateesh
Hi all,

I am facing one situation regarding PL/SQL

I an fetching two dates in a cursor like

cursor c1 is select iess.eventdate,
ss.insert_date,
s.shipment_gid
from ie_shipmentstatus,
status_history
shipment s
where iess.i_transaction_no = ss.trancastion.no
s.shipment_gid = ss.shipment_gid

the output of the cursor is as follows
eventdate insert_date shipment gid
25-dec-2006 11:59:20 25-dec-2006 11:20:20 1000
25-dec-2006 12:00:00 26-jan-2006 01:15:20 1000
26-jan-2007 1:35:25 26-jan-2007 01:45:25 1000
27-jan-2007 6:00:25 27-jan-2007 5:45:20 1001
27-jan-2007 6:00:00 27-jan-2007 7:00:20 1001

Here i want to compare 1st insert_date with 2nd eventdate
and 2nd insert_date with 3rd eventdate....etc for every shipment

Posted: Thu Apr 19, 2007 8:36 am
by nagatinno
Try using two cursor.

for ex cursor1 and cursor2.

place the cursor1 in the loop and compare it with cursor2 by advancing cursor2.

i mean by fetching values from cursor2 before fetching the values from cursor1.

In the loop fetching the values from cursor1 and cursor2 normallty and compare them.

Hope this will help you.