Home » Developer & Programmer » Forms » HELP IN "ON_ERROR " TRIGGER
icon7.gif  HELP IN "ON_ERROR " TRIGGER [message #343094] Tue, 26 August 2008 04:51 Go to next message
EL-SAYED
Messages: 17
Registered: July 2008
Junior Member
DEAR ALL:


if error_code=40508
 	then 
 		message('CAN NOT DUPLICATE THIS VALUE');
 		message('CAN NOT DUPLICATE THIS VALUE'); 	
else
	raise form_trigger_failure ;
end if ;




I USED THIS CODE IN TRIGGER "ON_ERROR " TO DISLAY MESSAGE TO USER WHEN HE DUPLICATE THE PK COLUMN.

THE PROBLEM IS :IT ALSO WORK WHEN THE USER ENTER VALUE IN FK COLUMN NOT FOUND AS PK IN ITS TABLE.

THANKS FOR HELP

Re: HELP IN "ON_ERROR " TRIGGER [message #343120 is a reply to message #343094] Tue, 26 August 2008 05:59 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You failed your test: don't post in UPPER case.

Regards
Michel
Re: HELP IN "ON_ERROR " TRIGGER [message #344626 is a reply to message #343094] Sun, 31 August 2008 02:49 Go to previous messageGo to next message
EL-SAYED
Messages: 17
Registered: July 2008
Junior Member
HI Michel Cadot

what the different between upper or lower case ?

i think the question's aim it is the important part in the question ...
Re: HELP IN "ON_ERROR " TRIGGER [message #344630 is a reply to message #344626] Sun, 31 August 2008 03:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
UPPER case: ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower case: abcdefghijklmnopqrstuvwxyz
SQL> select upper('Michel Cadot') upper,
  2         lower('Michel Cadot') lower
  3  from dual
  4  /
UPPER        LOWER
------------ ------------
MICHEL CADOT michel cadot

1 row selected.

Regards
Michel
Re: HELP IN "ON_ERROR " TRIGGER [message #344636 is a reply to message #344626] Sun, 31 August 2008 05:13 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
El-Sayed,

the main problem here is the fact that you have posted this message in the "Test" forum. Its description says:
Test forum description
Use this forum to post practice/experimental messages before posting to the other forums.


Michel said that your "test" message failed because you chose to use upper case which should be avoided, according to netiquette:
Quote:
avoid typing in ALL CAPS, which is considered shouting or yelling

You, on the other hand, failed to get the point.

Now, if your question has nothing to do with your real problem, it will remain here, in the "Test" forum. Otherwise, if you really need the answer (a hint: as validating different items raises this error, see if use of :SYSTEM.TRIGGER_ITEM system variable might help - include it into the IF construct), you should consider posting questions in the most appropriate forum (for this problem, it is the "Forms" forum). If you wish, moderators can move it over there.

Finally, if you still didn't do it, you might want to read the OraFAQ Forum Guide to get familiar with certain rules valid on the OraFAQ Forum.
icon5.gif  Re: HELP IN "ON_ERROR " TRIGGER [message #345638 is a reply to message #343094] Thu, 04 September 2008 06:18 Go to previous messageGo to next message
EL-SAYED
Messages: 17
Registered: July 2008
Junior Member
Littlefoot

first:thank you for your help.
second :
i cannot understand the way using :SYSTEM.TRIGGER_ITEM to handle my exception.

generaly i tried this one

if error_code=40509
 	then 
 		message('CAN NOT DUPLICATE THIS VALUE');
 		message('CAN NOT DUPLICATE THIS VALUE'); 	
else
	raise form_trigger_failure ;
end if ;


it raised succssfully when duplicat
but also appear when set un null column to null

realy whant to solve this problem
Re: HELP IN "ON_ERROR " TRIGGER [message #345726 is a reply to message #345638] Thu, 04 September 2008 11:01 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
i cannot understand the way using :SYSTEM.TRIGGER_ITEM to handle my exception.

This system variable returns BLOCK.ITEM for the current triggering event. As your "PK" and "FK" columns have different names (if not, which might be the case if there are two (master-detail?) blocks), you still have block name which can help you identify the item.

So, you'd have to include it into the IF construct as
IF :system.trigger_item = 'BLOCK_NAME.PK_COLUMN_NAME' AND 
   error_code=40509
THEN
   MESSAGE('your message here');
   RAISE form_trigger_failure;
END IF;
icon12.gif  Re: HELP IN "ON_ERROR " TRIGGER [message #346644 is a reply to message #345726] Tue, 09 September 2008 04:06 Go to previous message
EL-SAYED
Messages: 17
Registered: July 2008
Junior Member
Littlefoot

Thank You for your help.
i solved my problem
Previous Topic: looping comparison row by row
Next Topic: Creating Text Item at run time
Goto Forum:
  


Current Time: Sat Dec 03 03:52:21 CST 2016

Total time taken to generate the page: 0.11256 seconds