select into 與 insert into select,selectintoinsert

來源:互聯網
上載者:User

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;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.