This discussion is archived
5 Replies Latest reply: Mar 1, 2013 2:27 AM by FrançoisDegrelle RSS

Commit in Trigger

986110 Newbie
Currently Being Moderated
Hi All,

Can I use commit inside trigger.If I can, in which scenario it is needed and how can it be used?

Thanks & Regards,
  • 1. Re: Commit in Trigger
    ccortez Journeyer
    Currently Being Moderated
    Hello SB2013

    Yes you can use the commit statement inside a trigger.

    I give you two scenarios:

    1- You have a button item in a canvas and in it's trigger WHEN-BUTTON-PRESS you have an insert statement, so you want to save the insertion you must use a commit statement.

    2- You want to overwrite for example a trigger that already has the commit functionality but you want to perform a validation before use the commit statement.

    Hope my explanation helps you :)

  • 2. Re: Commit in Trigger
    user346369 Expert
    Currently Being Moderated
    Assuming you are talking about Forms triggers and not database triggers...

    It depends on the trigger. If it is just a when-button-pressed trigger on a "Save" or "Commit" button, then yes.

    I wouldn't use a commit after a sql Insert, because doing a commit anywhere in your form commits ALL work done up to that point.
  • 3. Re: Commit in Trigger
    986110 Newbie
    Currently Being Moderated
    Hi Steve ,
    I am talking about database triggers.I got this question in an interview.This is one part of the question.
    The other part is:
    Can we write DML statements in trigger?If yes then where this statements will be commited?
    Thanks in advance for Your help.

    Thanks & Regards,
  • 4. Re: Commit in Trigger
    986110 Newbie
    Currently Being Moderated
    Hi Ccortez,

    Thanks for your help. I think you have answered this question by keeping forms trigger in mind.But I have asked about the database trigger.

    Thanks & Regards,
  • 5. Re: Commit in Trigger
    FrançoisDegrelle Oracle ACE
    Currently Being Moderated
    Wrong forum. This is the Oracle Forms forum.
    You should ask in the SQL or database forum. (commit cannot be used in a database trigger).



  • Correct Answers - 10 points
  • Helpful Answers - 5 points