insert into return 语句在插入一条数据以后,返回某个字段的值非常方便,
下面演示:
SQL> drop table test;
drop table test
ORA-00942: table or view does not exist
SQL> create table test(today) as select sysdate from dual;
Table created
SQL> set serveroutput on;
SQL> declare
2 v_today date;
3 begin
4 insert into test values(sysdate) return today into v_today;
5 commit;
6 dbms_output.put_line(v_today);
7 end;
8 /
12-11月-09
PL/SQL procedure successfully completed
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7551038/viewspace-619472/
,如需转载,请注明出处,否则将追究法律责任。