RE: Insert into 2 tables at one time
- From: "Ken Naim" <kennaim@xxxxxxxxx>
- To: <jacintakean@xxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
- Date: Fri, 18 Mar 2005 09:02:15 -0500
You can do it in one statement with something called a multi table insert.
INSERT ALL
INTO emp (empid, empname,deptno)
VALUES (seq_emp_id.nextval, :empname,:deptno)
INTO dept (deptid,empid,deptname)
VALUES(:deptid, seq_emp_id.currval, :deptname);
-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Kean Jacinta
Sent: Friday, March 18, 2005 5:17 AM
To: oracle-l@xxxxxxxxxxxxx
Subject: Insert into 2 tables at one time
Hello
Need some help on this. I have 2 table
Emp
----------
empid (running on oracle sequenceno)
empname
deptid
Dept
----------
deptid
empid
deptname
I need to insert into emp table first and then get seqid just created and
insert into dept table. Would it be possible to do tat ?
__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
- References:
- Insert into 2 tables at one time
- From: Kean Jacinta
Other related posts:
- » Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » Re: Insert into 2 tables at one time
- » Re: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- » RE: Insert into 2 tables at one time
- Insert into 2 tables at one time
- From: Kean Jacinta