设为首页 加入收藏

TOP

selectinto与insertintoselect
2015-11-21 01:33:25 来源: 作者: 【 】 浏览:0
Tags:selectinto insertintoselect

一. 区别:

insert into select: 用于将select出来的结果集复制到一个新表中, 它是标准的sql语句

select into: 将结果保存到一个变量中, 它是plsql的赋值语句

二. 例子:

insert into select:

insert into test select * from t_source where id = 1;  
commit;  
select into:
create or replace procedure my_test is
  aa varchar2(100);
  v_record t_source%rowtype;
begin
  select name into aa from t_source where id = 1;
  dbms_output.put_line('普通变量 name= ' || aa);

  select * into v_record from t_source where id = 1;
  dbms_output.put_line('记录变量 name= ' || v_record.name);

end;

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇emoji表情字符插入的配置 下一篇11g新特性之activedatabaesduplic..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: