I have the following problem: - I can not execute a job (Scheduling) after an insert retrieved by the trigger.
Line 2: ORA-04092: Not possible on a trigger ORA-06512: in "SYS.DBMS_ISCHED", line 135 ORA-06512: under "SYS.DBMS_SCHEDULER", line 271 ORA-06512: under "TRG_GET_LAST_INSERT", line 9
create or replace TRIGGER trg_get_last_insert
BEFORE INSERT
ON TB_TOKEN
FOR EACH ROW
DECLARE
vToken NUMBER;
BEGIN
SELECT ID INTO vToken FROM TB_TOKEN WHERE ID = ( SELECT MAX(ID) FROM TB_TOKEN );
IF vToken IS NOT NULL THEN
dbms_scheduler.create_job (
job_name => 'TESTE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN
DELETE FROM TB_TOKEN WHERE ID = ' + vToken + '
END;COMMIT;',
enabled => true,
start_date => sysdate + 1/24,
repeat_interval=> null
);
END IF;
END;
Does anyone know how to do this? The idea is to pass the parameter that is rescued and delete it after 1 hour .