The RAISE_APPLICATION_ERROR procedure and associated -20000 to -20999 range of error numbers should be used by application-declared exceptions that are intended to be recognizable in outer PL/SQL layers or in the client program. Examples Example 11-5, "Naming Internally Defined Exception" ...
PRAGMA在PLSQL里有4个关键词的用法: (1)autonomous_transaction-自治事务,该程序块的commit或rollback不影响外层事务; (2)exception_init--错误代码与declare的标识符关联; (3)restrict_references--程序包的纯度级别; (4)serially_reusable--程序包级别的数据在引用之间不保留。 到目前...什么...
AUTONOMOUS_TRANSACTION Pragma,EXCEPTION_INIT Pragma,SERIALLY_REUSABLE Pragma
SERIALLY_REUSABLE 告诉PL/SQL 的运行时引擎,在数据引用之时不要保持包级数据。 === DECLARE e_products_invalid EXCEPTION; PRAGMA EXCEPTION_INIT (e_products_invalid, -2292); v_message VARCHAR2(50); BEGIN . . . EXCEPTION WHEN e_products_invalid THEN v_message := 'Product code specified is not...
SQL> SQL> INSERT INTO lecturer (id, first_name, last_name, major,current_credits) 2 VALUES (10012, 'Sharon', 'Clear','Computer Science', 3); 1 row created. SQL> SQL> SQL> CREATE OR REPLACE PACKAGE StudentOps AS 2 3 FUNCTION FullName(p_ID IN lecturer.ID%TYPE) 4 RETURN VARCHAR2...
EXCEPTIONWHENOTHERSTHENplog.error;ROLLBACK; RAISE;END; 自治事务可以用于在客户化程序中记录调试信息 PROCEDUREinsert_cux_debug_info( ... )ISPRAGMA AUTONOMOUS_TRANSACTION; ...BEGININSERTINTOcux_debug_infoVALUES...;COMMIT;END;
The following types of PL/SQL blocks can be defined as autonomous transactions: 以下的PL/SQL代码块可以定义为自治事务。 * Stored procedures and functions. 存储过程和函数 * Local procedures and functions defined in a PL/SQL declaration block. 定义在声明块里的本地存储过程和函数 ...
669 665| // If an exception occurs when attempting to run a query, we'll format the error 666| // message to include the bindings with SQL, which will make this exception a 667| // lot more helpful to the developer instead of just the database's errors. 668|...
SQL> Next, we insert another 8 rows using an anonymous block declared as an autonomous transaction, which contains a commit statement. 下一步,我们使用匿名的自治事务块插入另外8行数据,同时提交。 DECLARE PRAGMA AUTONOMOUS_TRANSACTION; BEGIN FOR i IN 3 .. 10 LOOP INSERT INTO at_test (id, descr...
(:b1, :b2, :b3) ; -- 测试数据 v_name : = 瑶瑶; v_sex : = ⼥; execute immediate v_sql_insert using 1, v_name , v_sex ; 【模拟报错违反主键约束】 -- : execute immediate v_sql_insert using 1, v_name , v_sex ; exception when others THEN p_log_info (违反主键约束); ...