Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

PLSQL Question

Posted on 2013-06-30
6
265 Views
Last Modified: 2013-07-26
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.
0
Comment
Question by:pp89
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 39288585
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
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 500 total points
ID: 39288744
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
 

Author Comment

by:pp89
ID: 39288755
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39288813
yes, you can as already mentioned.
0
 

Author Comment

by:pp89
ID: 39318008
Thanks all. It worked.
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39319871
good and thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creation date for a PDB 5 39
SQL2016 to ORACLE11G linked-server 6 28
Oracle 12c Default Isolation Level 17 41
minium over 4 numeric columns for each row in oracle 2 28
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question