Doubt in sql [message #85529] |
Tue, 06 July 2004 05:48 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/45399.jpg) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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
|
|
|
|