create table t_test_autono (id number);CREATE OR REPLACE PROCEDURE proc_test_autono AS PRAGMA AUTONOMOUS_TRANSACTION; BEGIN INSERT INTO t_test_autono VALUES (2);--自治事物插入数据 COMMIT; INSERT INTO t_test_autono VALUES (1);--主事物插入数据 ROLLBACK;--回滚主事物 END; SQL> exec proc_test_autono;
EXEC SQL EXECUTE DECLARE PRAGMA AUTONOMOUS_TRANSACTION; END-EXEC; 这样声明 根本就编译不过。 出现这样错误提示: PRAGMA AUTONOMOUS_TRANSACTION; ................................1 PLS-S-00103, Encountered the symbol "end-of-file" when expecting one of the foll owing: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursorSemantic error at line 36, column 3, file mytest.pc: DECLARE ..1 PCC-S-02347, PL/SQL found syntax errors请问是怎么回事了。
(id number);CREATE OR REPLACE PROCEDURE proc_test_autono AS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO t_test_autono VALUES (2);--自治事物插入数据
COMMIT;
INSERT INTO t_test_autono VALUES (1);--主事物插入数据
ROLLBACK;--回滚主事物
END;
SQL> exec proc_test_autono;
PL/SQL procedure successfully completed
SQL> select * from t_test_autono;
ID
----------
2
SQL>
pragma autonomous_transaction;
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
END-EXEC;
这样声明 根本就编译不过。
出现这样错误提示:
PRAGMA AUTONOMOUS_TRANSACTION;
................................1
PLS-S-00103, Encountered the symbol "end-of-file" when expecting one of the foll
owing: begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursorSemantic error at line 36, column 3, file mytest.pc:
DECLARE
..1
PCC-S-02347, PL/SQL found syntax errors请问是怎么回事了。