oracle--高级使用

1、俩种表复制语句

SELECT INTO和INSERT INTO SELECT两种表复制语句
CT: create table <new table> as select * from <exists table>
要求目标表不存在,因为在插入时会自动创建表,并将查询表中指定字段数据复制到新建的表中
IS: insert into table2 (f1,f2,..) select v1,v2.... from table1
要求目标表table2必须存在,由于目标表table2已经存在,所以我们除了插入源表 table1的字段外,还可以插入常量

  

2、merge into 用法

 MERGE INTO用法:
	merge into表A
	using与表A产生关联字段值 
	on进行和表A关联 
	  when matched then
	     update set...
	  when not matched then
                     insert ...) values

  

 

扫描二维码关注公众号,回复: 7318889 查看本文章

猜你喜欢

转载自www.cnblogs.com/eadela/p/11549121.html
今日推荐