Reputation:
I have tables named, TBL_LOGIN, TBL_USER, TBL_PERMISSION, TBL_SECTION
. TBL_LOGIN's
primary key is user_name
and at other tables user_name is foreign key
. I want to insert that username with only one sql command
. How can i do that?
Thanks for support :)
Upvotes: 0
Views: 109
Reputation: 8905
You can use the multi-table insert feature of oracle (from oracle 9i on)
CREATE TABLE TX1 ( X INT PRIMARY KEY, Y INT );
CREATE TABLE TX2 ( X INT PRIMARY KEY, Y DATE );
INSERT ALL
INTO TX1 VALUES (PKNUM,COL1)
INTO TX2 VALUES (PKNUM,COL2)
SELECT 1 pknum
, 8 COL1
, sysdate COL2
from dual;
Upvotes: 1