我有名为TBL_LOGIN, TBL_USER, TBL_PERMISSION, TBL_SECTION
. TBL_LOGIN's
主键是user_name
,在其他表 user_name 是foreign key
。我想insert that username with only one sql command
。我怎样才能做到这一点?
谢谢你的支持 :)
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;