Doubt in sql [message #85529] |
Tue, 06 July 2004 05:48  |
uma
Messages: 67 Registered: May 2001
|
Member |
|
|
Is it possible to insert a record into 2 tables using a single SQL Statement,if it is possible pls let me know the solution.
Regards,
Uma Devi
|
|
|
Re: Doubt in sql [message #85532 is a reply to message #85529] |
Tue, 06 July 2004 06:05   |
magnetic
Messages: 324 Registered: January 2003
|
Senior Member |
|
|
possible.
build a databasetrigger on table A wich will fire when there is an insert.
the code in the trigger should insert into table B.
|
|
|
Re:another way but only after 9i [message #85538 is a reply to message #85529] |
Wed, 07 July 2004 01:53   |
 |
vamsi kasina
Messages: 2112 Registered: October 2003 Location: Cincinnati, OH
|
Senior Member |
|
|
you can use insert all to insert whatever columns into whatever tables you want
INSERT ALL
INTO emp1 VALUES(empno,ename,sal)
INTO emp2 VALUES(empno,job,hiredate)
INTO emp3 VALUES(empno,deptno,mgr)
SELECT empno,ename,sal,hiredate,mgr,deptno
FROM emp;
|
|
|
Re:another way but only after 9i [message #85560 is a reply to message #85538] |
Thu, 08 July 2004 07:11   |
uma
Messages: 67 Registered: May 2001
|
Member |
|
|
Hi Vamsi,
Thanks for ur reply, the query is working fine it is allowing us to insert in 2 table using single sql statement but it is inserting more than 1 record(based on the no of recs available in the select query) can u pls tell what's the reason for this
|
|
|
|