We help IT Professionals succeed at work.

Oracle forms- commit question

anumoses
anumoses asked
on
300 Views
Last Modified: 2019-02-08
I have a code in key-commit of oracle forms that does some validation and gives a warning message. When user is trying to save, it give me the correct message. But they exit out it asks do you want to save, if I say YES, it save but does not give warning message and stop. So what trigger do I need. I tried on-commit. but go_block,. first_record are illegal
Comment
Watch Question

flow01IT-specialist
CERTIFIED EXPERT

Commented:
Is it possible to give the code  you want to execute ?  Maybe we can find a workaround, to avoid the navigation.
One possibilty I'm thinking of is to use the post-builtin in the on-commit to propagate the changes in the form to the database (insert,update,delete) and  perform your validations on the database records instead of the data in form  before issuing the commit-form built-in to execute the actual commit in the database.
Another way can be to keep track of the relevant data that you need for checking (for example in a package either in the form or in the database or in a temporary table )  and do your validation on that kept data.
Mark GeerlingsDatabase Administrator
CERTIFIED EXPERT

Commented:
Without knowing exactly what you want to do, it is hard for us to know the best way to get the job done.

It is true that an "ON-COMMIT" trigger cannot do form navigation activities, like GO_BLOCK, FIRST_RECORD, etc.  A "KEY-COMMIT" trigger can do form navigation activities like that.

But, I don't recommend using a "KEY-COMMIT" trigger to do validation.  I like to do validation earlier in the process, ideally in WHEN-VALIDATE-ITEM triggers, or at least in PRE-INSERT or PRE-UPDATE triggers.  I use a program unit that can be called from both a PRE-INSERT and a PRE-UPDATE trigger, if I need the same logic to happen for both events.

Author

Commented:
I tried using this code. declared global  variable

key-commit

:GLOBAL.COMMIT := '1';
COMMIT_FORM;
:GLOBAL.COMMIT := '0';

pre-commit

DEFAULT_VALUE('0','GLOBAL.COMMIT');
IF :GLOBAL.COMMIT = '0' THEN
ERASE('GLOBAL.COMMIT');
      msg_alert('Warning! This invoice must be in balance in order to save & close.','E',true);
RAISE FORM_TRIGGER_FAILURE;
END IF;

This is working
Database Administrator
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
thanks. Handled in a different way.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions