×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Insert Trigger

Insert Trigger

Insert Trigger

(OP)
Hi All,

I have an row level after insert trigger on table DEPT which calls a stored procedure to dynamically create a trigger on a different table based on the values inserted into table DEPT. I get the following error :

ORA-04092: cannot COMMIT in a trigger
ORA-06512: at "SCOTT.PKG_GENERATE_TRIGGERS", line 166
ORA-06512: at "SCOTT.PKG_GENERATE_TRIGGERS", line 277
ORA-06512: at "SCOTT.TRG_RA_INS_DEPT", line 3
ORA-04088: error during execution of trigger 'SCOTT.TRG_RA_INS_DEPT'

I understand that you cannot have any commits inside the trigger body, however the same happens on an Alter trigger based at the schema level which is supposed to allow CREATE statements in the trigger body.  Does anyone know how I get around this problem.
I am using Oracle8i 8.1.5.

Any help is appreciated greatly.

Thanks

Ketan


RE: Insert Trigger

Hi Ketan,

You can try to use autonomous transaction (a new feature of 8i). All you have to do is to add a PRAGMA AUTONOMOUS_TRANSACTION in your procedure:

CREATE PROCEDURE ... AS PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
  ...
END;

You only have to know that this transaction will be commited despite of your main transaction success or failure.

RE: Insert Trigger

Hi,
Its not possible to write any DDL statement within the trigger body as each DDL fires the COMMIT statement before execute.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close