Home » Developer & Programmer » Forms » raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data
raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #147684] Sat, 19 November 2005 02:38 Go to next message
adamjsawyer
Messages: 79
Registered: April 2005
Location: Perth, Western Australia ...
Member
Hi, I have a WHEN-VALIDATE-RECORD trigger on one of my data blocks. When there is an problem with the data, I use RAISE FORM_TRIGGER_FAILURE. The error dialog appears, but it's still saving the data to the database!

Here is the code for the WHEN-VALIDATE-RECORD trigger:

-- WHEN-VALIDATE-RECORD Trigger for WTL_USERS Block in form MANAGE_ACCOUNTS

DECLARE
v_user_name VARCHAR2(10);
v_alert_button NUMBER;
BEGIN
-- Check if this is the ADMIN account
-- If it's a new account an error will occur - this is OK, nothing happens
SELECT user_name
INTO v_user_name
FROM wtl_users
WHERE user_id = :WTL_USERS.USER_ID;

-- If this is the ADMIN account, you cannot disable it
IF v_user_name = 'ADMIN' THEN

-- Ensure that the ADMIN account has not been disabled
IF :WTL_USERS.USER_ACTIVE = 'N' THEN
v_alert_button := SHOW_ALERT('ADMIN_ACTIVE_ALERT');
RAISE FORM_TRIGGER_FAILURE;
ELSIF :WTL_USERS.USER_NAME != 'ADMIN' THEN
v_alert_button := SHOW_ALERT('ADMIN_NAME_ALERT');
RAISE FORM_TRIGGER_FAILURE;
ELSIF :WTL_USERS.USER_ROLE != 'A' THEN
v_alert_button := SHOW_ALERT('ADMIN_ROLE_ALERT');
RAISE FORM_TRIGGER_FAILURE;
END IF;

END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;

What am I doing wrong?

Thanks
Adam
Re: raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #147686 is a reply to message #147684] Sat, 19 November 2005 02:48 Go to previous messageGo to next message
adamjsawyer
Messages: 79
Registered: April 2005
Location: Perth, Western Australia ...
Member
LOL!

My exception handling was cancelling out the FORM-TRIGGER-FAILURE!

I am an idiot!

cheers
Adam
Re: raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #426680 is a reply to message #147686] Sun, 18 October 2009 22:00 Go to previous messageGo to next message
lekshman
Messages: 4
Registered: October 2009
Location: Banglore
Junior Member
i have the same problem as above.. wat do i need to give.?
i have Raise form_trigger_failure in both the IF block and also in the exception, but this raise_form_trigger is not at all being called.even i took out the Raise form_trigger_failure in the exception block and tried, still not wrking. Sad
Re: raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #426731 is a reply to message #147684] Mon, 19 October 2009 03:54 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why don't you post your code - in code tags (see the orafaq forum guide if you're not sure how) - and we'll take a look.

One second thoughts - don't. You already have elsewhere.
Please don't resurrect old threads, especially when you've already started a new one for your issue, it just confuses things.

EDIT: added 2nd para.

[Updated on: Mon, 19 October 2009 03:57]

Report message to a moderator

Re: raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #426983 is a reply to message #147684] Tue, 20 October 2009 08:31 Go to previous messageGo to next message
m.mahran
Messages: 1
Registered: October 2009
Junior Member
Hi,

I have the same problem (raise form_trigger_failure) doesn't work
Re: raise form_trigger_failure in WHEN-VALIDATE-RECORD still saves data [message #426988 is a reply to message #426731] Tue, 20 October 2009 08:44 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Mon, 19 October 2009 09:54
Why don't you post your code - in code tags (see the orafaq forum guide if you're not sure how) - and we'll take a look.


Previous Topic: How does one make next_record built-in working automatic?
Next Topic: duplicate record is not working ??
Goto Forum:
  


Current Time: Fri Sep 20 06:44:27 CDT 2024