oracle中的select into & insert into

以前用sqlserver时习惯用 select * into tablename1 from tablename2 where ... 来复制表结构和数据。今天在用oracle时,需要复制表结构和数据,不加思索地写了同上的语句,结果报错,缺少关键字。

  select into 的用法结构是

SELECT [DISTICT|ALL]{*|column[,column,...]}
INTO (variable[,variable,...] |record)
FROM {table|(sub-query)}[alias]
WHERE......

  能类似实现此功能的语句有create table table1 as select * from table2 这句是先创建一个表,再复制结构和数据过去。

  还有个就是insert into table1 select * from table2 where...   实现上面同样的功能。

posted on 2011-03-17 10:39  banditi  阅读(15024)  评论(0编辑  收藏  举报