oracle中的select into & insert into
2020-12-03 8:58:38
by 技术文章

打印???
天盟网(http://www.aksky.com)
技术文章(http://www.aksky.comhref=category.php?cid=1)

oracle中的select into & insert into


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

SELECT [DISTICT|ALL]
INTO (variable[,variable,...] |record)
FROM [alias]
WHERE......

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

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



Copyright © 2002-2022 http://www.aksky.com
All rights reserved.

备案号:浙ICP备17002154号-2 Powered by: myarticle.com.cn Version 1.0dev
Processed Time: 0.0015 s Querys: 4 [ Gzip Level 0 ]