Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DBMS_SCHEDULER.CREATE_JOB and trigger

AyhamJun 4 2012 — edited Jun 4 2012
Hi to all,
Please inform my if there is another way to create job in trigger to run batch file.



SQL> create table test( name varchar2(200));

Table created.

SQL> create or replace
2 TRIGGER AFT_INSERT
3 AFTER INSERT ON Test
4 FOR EACH ROW
5 DECLARE
6 a varchar2(200);
7 BEGIN
8
9 create_job_through_trigger;
10
11 END ;
12 /

Trigger created.

SQL> insert into test values('ff');
insert into test values('ff')
*
ERROR at line 1:
ORA-04092: cannot in a trigger
ORA-06512: at "SYS.DBMS_ISCHED", line 124
ORA-06512: at "SYS.DBMS_SCHEDULER", line 271
ORA-06512: at "FINAL.VSM_SCHEDULER", line 5
ORA-06512: at "FINAL.AFT_INSERT", line 5
ORA-04088: error during execution of trigger 'FINAL.AFT_INSERT'

The create_job_through_trigger

CREATE OR REPLACE PROCEDURE create_job_through_trigger
is

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'ajob',
job_type => 'EXECUTABLE',
job_action => 'c:\a.bat',
enabled => false);
END;
/
This post has been answered by ShankarViji on Jun 4 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2012
Added on Jun 4 2012
2 comments
4,521 views