pragma autonomous_transaction : restrict_references(<fuctionname>,wnds) and serially_resumable
来源:互联网 发布:linux复制目录命令 编辑:程序博客网 时间:2024/05/29 17:24
pragma : serially_reusable
SQL> CREATE PACKAGE pkg1 IS
PRAGMA SERIALLY_REUSABLE;num NUMBER := 0;
PROCEDURE init_pkg_state(n NUMBER);
PROCEDURE print_pkg_state;
END pkg1;
/ 2 3 4 5 6 7
Package created.
SQL> CREATE PACKAGE BODY pkg1 IS
PRAGMA SERIALLY_REUSABLE;
PROCEDURE init_pkg_state (n NUMBER) IS
BEGIN
pkg1.num := n;
END;
PROCEDURE print_pkg_state IS
BEGIN
dbms_output.put_line('Num: ' || pkg1.num);
END;
END pkg1;
/ 2 3 4 5 6 7 8 9 10 11 12
Package body created.
SQL>
SQL>
SQL> exec pkg1.init_pkg_state(10);
PL/SQL procedure successfully completed.
SQL> exec pkg1.print_pkg_state;
Num: 0
PL/SQL procedure successfully completed.
pragma :autonomous_transaction
SQL> create table t(ab date);Table created.
SQL> create or replace package pkg2 is
function fn_auto return number;
end pkg2;
/ 2 3 4
Package created.
SQL> create or replace package body pkg2 is
function fn_auto return number
is
begin
insert into t values(sysdate);
commit;
return 1;
end;
end pkg2;
/ 2 3 4 5 6 7 8 9 10
Package body created.
SQL> select pkg2.fn_auto() test from dual;
select pkg2.fn_auto() test from dual
*
ERROR at line 1:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "QDL.PKG2", line 5
SQL> create or replace package body pkg2 is
function fn_auto return number
is
pragma autonomous_transaction;
begin
insert into t values(systimestamp);
commit;
return 1;
end;
end pkg2;
/ 2 3 4 5 6 7 8 9 10 11
Package body created.
SQL> select pkg2.fn_auto() test from dual;
TEST
----------
1
pragma :restrict_references(fn_auto,wnds)
make the compiler compile the function fn_auto according to WNDS (write no database ) , so after the package boday created, you see the compile error directly.
- pragma autonomous_transaction : restrict_references(<fuctionname>,wnds) and serially_resumable
- PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS);
- pragma restrict_references
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION
- Oracle PRAGMA RESTRICT_REFERENCES 理解
- 关于PRAGMA RESTRICT_REFERENCES 的理解
- PRAGMA AUTONOMOUS_TRANSACTION自治事务
- 自治事务 PRAGMA AUTONOMOUS_TRANSACTION
- PRAGMA AUTONOMOUS_TRANSACTION 自制事物
- PRAGMA AUTONOMOUS_TRANSACTION自治事务
- PRAGMA AUTONOMOUS_TRANSACTION 自制事务
- Python与C/C++ 模块相互调用
- NDK-jni error for android
- Juniper SRX Destination NAT中内网访问映射地址问题
- Linux音频编程指南
- ios 十进制转十六进制方法
- pragma autonomous_transaction : restrict_references(<fuctionname>,wnds) and serially_resumable
- 一个Java程序员应该掌握的10项技能
- js调用webservice
- SQL Server常用链接
- 结构体4字节对齐规则的详解
- ORACLE 表空间转换
- MapReduce:详解Shuffle过程
- Java开发环境和搭建
- test-nginx