insert into…select 跟 select into 的区别
在oracle中这两种语句都是支持的,但使用的场合很不相同。
insert into … select …是一条dml语句,它完成从一张表中查出数据,并把这些数据插入到指定的表中。
select into 语句是一个查询语句,在oracle中,他只使用在存储过程、函数以及pl/sql块中,它是把选出的数据賦值到以定义的变量中。如:
declare
inti int;
begin
select 2 into inti from dual;
dbms_output.put_line(inti);
end;