select into 与 insert into select,selectintoinsert
一. 区别:
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;
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。