Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Two Cursors in a procedure

user13034857Sep 3 2013 — edited Sep 5 2013

I am working on procedure, Please give ideas where i can develop this logic more meaning and easy

the logic is as follows

Table1 is having same Id's ABC having same seq number 100 as per legacy data (This is wrong entry in legacy data)

ID     --    Seqnum

ABC --     100

ABC --     100

I created a table2 where it will have max seqnum from legacy for this ID's for example ABC

ID  -- Max seqnum

ABC --500

In my procedure I will have two cursors

First cursor will be have Table1 detail

Second Cursor will have Table2 Details

In above ex the table will have the first record should be unchanged i.e.,

ABC --     100 --100

but second record will change to

ABC --     100 -- 501(This next value of the max seq number from table 2/Cursor 2)

I have to create third column which will hold the next seqnumber for that ID ABC

I should load both records changing the seqnumber so I will not have any duplicate records for same ID.

So final records will look like

ID            Seq#       Final_Seq#

ABC --     100 --     100

ABC --     100 --      501

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2013
Added on Sep 3 2013
4 comments
473 views