PLSQL Question

Hi All,

I am inseting data into tables using nested loops and at last I am performing commit of the entire transaction. Now I want to do a update on the same table into which I am inserting. So how do I do this?
Because before commit I cannot do the update on same table. And if I write update statement after commit then I cannot refer cursor variables as all my loops are closed.

Thanks for your help.
pp89Asked:
Who is Participating?
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
update can be done in the loop itself and that one final commit will do to make those inserts/updates permanent.

out of curiosity, does the updates what you are planning to do in the loop have any relation to the inserts/data which is getting processed in the loop or how is that ?
0
 
flow01Commented:
After insert you can update the same record,  no commit needed.

But depending on what you need for update,  you can also store records to insert in a pl/sql-collection, update a record in the collection and insert the whole collection with one forall-statement.
0
 
pp89Author Commented:
Requirement is to insert record by record using nested loops and finally before last loop I am performing a commit operation.
So after insert in a loop can I update the same table in which I am inserting?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Naveen KumarProduction Manager / Application Support ManagerCommented:
yes, you can as already mentioned.
0
 
pp89Author Commented:
Thanks all. It worked.
0
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
good and thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.