Home » Developer & Programmer » Forms » Not able to fire ON-COMMIT (Oracle Forms 6i)
Not able to fire ON-COMMIT [message #632618] Tue, 03 February 2015 12:52 Go to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
Hello,

I have created one form. In that form I am able to fire KEY-COMMIT trigger but ON-COMMIT trigger is not firing in any case.

Please help me.
Re: Not able to fire ON-COMMIT [message #632647 is a reply to message #632618] Tue, 03 February 2015 15:13 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How do you know it doesn't fire? Did you put MESSAGE call in there (so that it tells you whether it is executed or not)?

Also, as you coded KEY-COMMIT, did you put COMMIT statement in there? KEY-COMMIT will NOT commit by itself, you have to do it. It means that - if there's no COMMIT - ON-COMMIT trigger won't fire.
Re: Not able to fire ON-COMMIT [message #632657 is a reply to message #632647] Tue, 03 February 2015 23:12 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
Yes, I have put message call inside ON-COMMIT trigger.

Yes , I have used COMMIT_FORM inside KEY-COMMIT trigger. but still its not firing ON-COMMIT trigger.
Re: Not able to fire ON-COMMIT [message #632661 is a reply to message #632657] Wed, 04 February 2015 00:10 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Unfortunately, no further ideas. Hopefully, someone else will assist.
Re: Not able to fire ON-COMMIT [message #632673 is a reply to message #632661] Wed, 04 February 2015 03:10 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have you made any changes to the datablocks that need commiting?
If there's nothing to save commit_form won't do anything.
Re: Not able to fire ON-COMMIT [message #632676 is a reply to message #632673] Wed, 04 February 2015 03:17 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
Yes I have made some changes in some fields under database block.
Actually it fires Key-commit but on-commit is not fired.
Re: Not able to fire ON-COMMIT [message #632687 is a reply to message #632676] Wed, 04 February 2015 08:06 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
What code exactly is in key-commit?
What level is on-commit defined at - form, block?
What exact code is in on-commit?
Does pre-insert/pre-update (whichever is applicable) fire?
Re: Not able to fire ON-COMMIT [message #632688 is a reply to message #632687] Wed, 04 February 2015 08:15 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
In KEY-COMMIT, I have written only commit_form.
In ON-COMMIT, I have written some restriction which is at form level.
Re: Not able to fire ON-COMMIT [message #632689 is a reply to message #632688] Wed, 04 February 2015 08:32 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
So that answers the first two questions, what about the last two?
Re: Not able to fire ON-COMMIT [message #632690 is a reply to message #632688] Wed, 04 February 2015 08:41 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Is your data block a Control Block or a Base Table Block? At which level is your Key-Commit trigger? Do you have more than one Key-Commit or On-Commit trigger(s)?

Can you show us your On-Commit trigger code?

Craig...
Re: Not able to fire ON-COMMIT [message #632691 is a reply to message #632690] Wed, 04 February 2015 08:56 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
Only One ON-COMMIT and key-commit trigger is defined. Both are at form level.
Yes It is firing pre-insert and pre-update trigger.
My data block is base table itself.
I have made soMe Restriction only in ON-COMMIT trigger
Re: Not able to fire ON-COMMIT [message #632692 is a reply to message #632691] Wed, 04 February 2015 09:05 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Can we see your code for your Pre-Insert, Pre-Update and On-Commit triggers. We can't help diagnose the problem without seeing your code!

Craig...
Re: Not able to fire ON-COMMIT [message #632709 is a reply to message #632692] Wed, 04 February 2015 13:23 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
PRE-INSERT
==============
DECLARE
VBUSCD NUMBER;
BEGIN
SELECT MAX(BUSCD) INTO VBUSCD FROM BUSMAS;

:BUSMAS.BUSCD := NVL(VBUSCD,0) + 1;
END;


RESTRICT_BUS_TYPE; --Some restiction


PRE-UPDATE
============
RESTRICT_BUS_TYPE; --Some restiction


I want to call this procedure from ON-COMMIT instead of PRE-INSERT AND PRE-UPDATE.

Re: Not able to fire ON-COMMIT [message #632710 is a reply to message #632709] Wed, 04 February 2015 13:27 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
*restriction
Re: Not able to fire ON-COMMIT [message #632728 is a reply to message #632618] Thu, 05 February 2015 00:33 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

try to commit form using push button , instead on key-commit.
this may help.
Re: Not able to fire ON-COMMIT [message #632733 is a reply to message #632728] Thu, 05 February 2015 01:02 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; there's no need for such a KEY-COMMIT trigger as it, really, does nothing. I'd remove it.

Did you, by any chance, set :SYSTEM.MESSAGE_LEVEL to a high value so that it doesn't allow messages to show on the screen? Because, maybe RESTRICT_BUS_TYPE raises an error and you don't see it, thinking that the trigger doesn't fire.
Re: Not able to fire ON-COMMIT [message #632735 is a reply to message #632733] Thu, 05 February 2015 01:12 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
actually I need to put some restriction in ON-COMMIT trigger. key-commit is not required.

I haven't set any message_level.
Re: Not able to fire ON-COMMIT [message #632736 is a reply to message #632735] Thu, 05 February 2015 02:20 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

You can put your restriction on push button also ,
you can use conditions to commit form.
for ex
if condition is true then commit_form
       else
       message or error anything else you want to display or do
end if;
Re: Not able to fire ON-COMMIT [message #632742 is a reply to message #632736] Thu, 05 February 2015 03:23 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You still haven't told us what code you put in on-commit or how you determined it wasn't firing.

That said it seems I'm a bit confused on the commit processing here, maybe someone with a working forms installation can help me out.
Key-commit by default runs commit_form.
The example in the documentation for on-commit says you should put commit_form in there.

If commit_form causes on-commit to fire then you would have thought that putting commit_form in on-commit would cause an infinite loop.
So either the docs are wrong or forms actually changes the behaviour of commit_form based on which trigger called it, which seems doubtful.


Re: Not able to fire ON-COMMIT [message #632743 is a reply to message #632742] Thu, 05 February 2015 03:24 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
@ishanjrana - the usual place to put code that stops people saving changes to a record is when-validate-record, is there any reason you aren't using it?
Re: Not able to fire ON-COMMIT [message #632748 is a reply to message #632743] Thu, 05 February 2015 03:48 Go to previous messageGo to next message
ishanjrana
Messages: 10
Registered: July 2014
Location: India
Junior Member
My ON-COMMIT trigger would be like :

RESTRICT_BUS_TYPE; --Some restriction
COMMIT_FORM;

I want to call this procedure from ON-COMMIT only instead of pre-insert and pre-update.
In ON_COMMIT trigger I have put an message call so that I came to know that its not firing ON-COMMIT.

Yes, generally we are using when-validate-record but in this case it causing me some problem so I am trying using ON-COMMIT.


KEY-COMMIT
=========
COMMIT_FORM;
Re: Not able to fire ON-COMMIT [message #632749 is a reply to message #632748] Thu, 05 February 2015 03:52 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
ishanjrana wrote on Thu, 05 February 2015 09:48
Yes, generally we are using when-validate-record but in this case it causing me some problem so I am trying using ON-COMMIT.


What problem?

Also as a general point - never use key-commit, it can be bypassed. For example if you make changes and then exit the form you will be asked if you want to save changes, clicking on yes will save the changes without key-commit being fired.
Re: Not able to fire ON-COMMIT [message #632760 is a reply to message #632749] Thu, 05 February 2015 08:54 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
I really can't make sense of what you are trying to do since you won't show your RESTRICT_BUS_TYPE code. I recommend you run your form from the Forms Builder in Debug mode and step through your code so you can see what it is and isn't doing. What is your Forms version? The other option would be to run your form with the Forms Runtime Diagnostics (FRD) enabled and then review the log file produced by FRD.

Craig...
Re: Not able to fire ON-COMMIT [message #632798 is a reply to message #632760] Thu, 05 February 2015 16:06 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is 6i (as stated when the OP created this topic), so - no debug mode, unfortunately (which is probably why nobody suggested that).
Re: Not able to fire ON-COMMIT [message #632985 is a reply to message #632798] Mon, 09 February 2015 10:13 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Actually, Oracle Forms 6i DOEShave a debug mode. Personally, I think it is easier than the debugger in Forms 9i and higher because you only need the Forms Runtime installed (which should be installed if you didn't change the default instalation options)instead of the OC4J or WebLogic Server (WLS) in order to run your Form from the Forms Builder in Debug Mode. In Forms 6i, you have to actually code the break point with the BREAK() built-in.

Craig...
Re: Not able to fire ON-COMMIT [message #665170 is a reply to message #632736] Thu, 24 August 2017 02:42 Go to previous messageGo to next message
adil shakeel
Messages: 47
Registered: August 2017
Member
please write the full code behind the on commit trigger
Re: Not able to fire ON-COMMIT [message #665172 is a reply to message #665170] Thu, 24 August 2017 03:38 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You do realise this thread is 2 years old?
I very much doubt the OP is going to post the code now.
Previous Topic: The cause of ora-01403 no data found error
Next Topic: Configuration LAF with Forms
Goto Forum:
  


Current Time: Fri Mar 29 00:07:03 CDT 2024