Home » Developer & Programmer » Forms » message on trigger
message on trigger [message #241259] Tue, 29 May 2007 00:40 Go to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Hi all,
I created trigger for BEFORE INSERT OR UPDATE. When testing, I want to pop a message just like in forms(message('msg')). How to do this in trigger? I tried these two but no message poped up.
RAISE_APPLICATION_ERROR (-20100, 'Operation not allowed');
DBMS_OUTPUT.PUT_LINE('here');
Re: message on trigger [message #241261 is a reply to message #241259] Tue, 29 May 2007 00:42 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Where do you want to 'pop' your message to?
A database trigger runs on the database server.
A guess:
Remove your exception handler (when others then dbms_output.put_line....).
Re: message on trigger [message #241265 is a reply to message #241259] Tue, 29 May 2007 01:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The exceptions (and the raise_application_error) is the way the Oracle server "pops" an error message.

You have to trap it in your application and do waht you want with it.

Regards
Michel
Re: message on trigger [message #241267 is a reply to message #241259] Tue, 29 May 2007 01:08 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I want it to pop on forms after I insert/update records, just like alert or double message on forms. Now, if it's not possible, how can I catch error return by that trigger on forms so that I can code message on forms?
Re: message on trigger [message #241284 is a reply to message #241267] Tue, 29 May 2007 01:50 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Is this a forms trigger or a server one?

Regards
Michel
Re: message on trigger [message #241295 is a reply to message #241259] Tue, 29 May 2007 02:22 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

server trigger
Re: message on trigger [message #241296 is a reply to message #241295] Tue, 29 May 2007 02:25 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Server trigger works on server and can't pop anything on client.
You have to trap the exception in your client application and then pop there.

Regards
Michel
Re: message on trigger [message #241304 is a reply to message #241259] Tue, 29 May 2007 03:10 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

How to do that?
Re: message on trigger [message #241311 is a reply to message #241304] Tue, 29 May 2007 03:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't know Forms.
I transfer this topic to this forum maybe they can help you.

Regards
Michel
Re: message on trigger [message #241876 is a reply to message #241259] Wed, 30 May 2007 15:32 Go to previous message
hemavb
Messages: 103
Registered: May 2007
Location: Dubai , UAE
Senior Member
U have 2 options:

Option 1: Block level trigger.
if the insert/update is happening thru forms and you are using a database block, the easiest thing is to tranfer your triggers from the database to the block. Use Pre-insert for Before Insert trigger and Post-Insert for After Insert trigger. Same will be for Update and Delete triggers

Pre triggers fire before Commit/Post statements hit the database.
Post triggers fire after the data is commited.

Drawback:
you will have to use this particular form for entering data to the database at all times. Any insert or update done from the other forms/directly from the SQL or database will not fire any triggers.


Option 2: Pre-commit Checks.
AT the form -level triggers in forms, put all the exception checks that may cause the insert/update/delete triggers to fail, in the PRE-COMMIT trigger. DONOT use GO_ITEM or GO_BLOCK procedures here. You donot have to say COMMIT as this trigger runs before passing on a COMMIT or POST command to the Database.

Drawback:
For this you have to be clear of what all errors/exceptions may occur.

Lemme know if you need any clarifications.
Previous Topic: i need help
Next Topic: Set menu item property enabled/disabled
Goto Forum:
  


Current Time: Fri Dec 02 23:01:14 CST 2016

Total time taken to generate the page: 0.05637 seconds