Oracle forms- commit question

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
LVL 6
anumosesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

flow01IT-specialistCommented:
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 AdministratorCommented:
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.
anumosesAuthor 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
Mark GeerlingsDatabase AdministratorCommented:
Are you sure that is doing the validation that you want?  It looks to me like with those two triggers, you will never get the warning message displayed.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anumosesAuthor Commented:
thanks. Handled in a different way.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.