但是oracle有提供更簡單方法叫做insert into select
語法
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[(col_name
,...)]
SELECT ...
[ ON DUPLICATE KEY UPDATE col_name
=expr
, ... ]
範例
INSERT INTO tbl_temp2 (fld_id)
SELECT tbl_temp1.fld_order_id
FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;
沒有留言:
張貼留言