1. 備份表:
create table aa_new as select * from aa ;
2. 只複製表結構:實際上與1類似,只不過 沒有數據
create table aa_new as select * from aa where 1=0;
3. 只複製表數據:
select into from 和 insert into select都是用來複製表,兩者的主要區別爲:
select into from 要求目標表不存在,因爲在插入時會自動創建,insert into select from 要求目標表存在
(1)Insert into
如果 兩個表結構一樣 則 直接
Insert into dd select * from aa;
也可以根據字段篩選插入
Insert into bb(column1,column12,...) select value1,value2,... from aa;
(2)select into from
SELECT (column1,column12,...) INTO bb FROM aa;
plsql ,sqlplus 執行這條語句,會報"ORA-00905:缺失關鍵字"錯誤