I'm trying to create a sequence
in a trigger
.
When trying to create by Execute Immediate
, I'm having the following return:
ORA: 4092 - Can not commit in a trigger.
For all I've ever researched, using Execute Immediate
in a trigger is not possible, since it is in dll
which issues an automatic commit
.
I would like to know if there is any other way to create a sequence by a trigger.
Follow the trigger code
CREATE OR REPLACE TRIGGER "TR_TEST"
AFTER UPDATE ON TEST_TABLE
FOR EACH ROW
DECLARE
BEGIN
BEGIN
EXECUTE IMMEDIATE 'CREATE SEQUENCE SEQ01' ||
' MINVALUE 1' ||
' MAXVALUE 999999999999999999999999999' ||
' START WITH 1' ||
' INCREMENT BY 1' ||
' NOCACHE';
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20200, 'Error');
END;
END