Home » SQL & PL/SQL » SQL & PL/SQL » Join in Insert
Join in Insert [message #584896] Mon, 20 May 2013 07:01 Go to next message
Messages: 8
Registered: February 2009
Location: Karachi
Junior Member

I am trying to insert records in multiple tables. I know how to view data using joinig, but unable to understand how to insert records in multiple tables using Joining. I searched it on net, but didn't find much. I have also tried to write a code, but it is not working, I have seen some examples on different websites where people are using SELECT in INSERT statement for joining. Kindly tell me the correct Syntax to INSERT record in Multiple tables.

Insert into library_users, library_users_info
(library_users.username, library_users.password, library_users_info.address, library_users_info.phone_no) VALUES (...)

[Updated on: Mon, 20 May 2013 07:02]

Report message to a moderator

Re: Join in Insert [message #584899 is a reply to message #584896] Mon, 20 May 2013 07:06 Go to previous messageGo to next message
Messages: 21148
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You can't do that. INSERT works with a single table only (unless you insert into a view, whose INSTEAD OF triggers do additional job and insert into different tables). Though, you could use INSERT ALL, such as
insert all
  into library_users (username, password) values ('lf', 'pwd')
  into library_users_info (address, phone_no) values ('croatia', '12345')
select * from dual
Re: Join in Insert [message #584901 is a reply to message #584896] Mon, 20 May 2013 07:09 Go to previous message
Solomon Yakobson
Messages: 2627
Registered: January 2010
Location: Connecticut, USA
Senior Member
Did you read documentation? Look for multi table insert under INSERT

Previous Topic: Tablespace Monitoring script
Next Topic: Please help me to implement this.
Goto Forum:

Current Time: Mon Aug 21 10:58:27 CDT 2017

Total time taken to generate the page: 0.08372 seconds