admin 管理员组

文章数量: 887021

一. 区别:

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;

本文标签: select insert