Home » Developer & Programmer » Forms » Problem with Raise FORM_TRIGGER_FAILURE (Forms 6i)
Problem with Raise FORM_TRIGGER_FAILURE [message #381431] Fri, 16 January 2009 22:52 Go to next message
rushimails
Messages: 24
Registered: November 2008
Location: Mumbai
Junior Member
I have a procedure which checks for Duplicate record in a Multi-Record Block.
In this Procedure whenever a Duplicate record is found it shows alerts and the Raises the RAISE FORM_TRIGGER_FAILURE exception.

Since This procdure is to check for Duplicacy in Multi-record it has to Navigate within the Block.
SO it has been called in KEY-NEXT-ITEM.

My Problem is that Say in Employee details multi-record block on EMployee Number I have the following trigger contents,

KEY-NEXT-ITEM-> (Employee Number)

CHECK_DUPLICATE_RECORD;
MESSAGE('Hi I must not fire if DUplicate record found in CHECK_DUPLICATE_RECORD Procedure');message(' ');


Now in case of duplicate records everything goes fine except that the
Message 'Hi I must not fire if DUplicate record found in CHECK_DUPLICATE_RECORD Procedure' is also fired.
Ideally RAISE FORM_TRIGGER_FAILURE must stop the further execution but it is not.

Is there any problem or somewhere my understanding is wrong.
Can someone please comment on this.


CHECK_DUPLICATE_RECORD ==>
PROCEDURE CHECK_DUPLICATE_RECORD IS  
	V_LAST_RECORD		NUMBER 	:= 0;
	V_CURR_RECORD		NUMBER	:= 0;   
	V_NEW_ITEM_VAL  	VARCHAR2(1000);
	V_ITEM_NAME	        VARCHAR2(100);
	V_ITEM_VAL	        VARCHAR2(100);   
BEGIN
	V_ITEM_NAME	:= NAME_IN('SYSTEM.CURSOR_ITEM');
	V_ITEM_VAL	:= NAME_IN('SYSTEM.CURRENT_VALUE');
    GO_BLOCK(NAME_IN('SYSTEM.CURSOR_BLOCK'));
  
  V_CURR_RECORD	:=	:SYSTEM.CURSOR_RECORD; --Captures Current POsition
  	FIRST_RECORD;
  	LAST_RECORD;
  V_LAST_RECORD	:=	:SYSTEM.CURSOR_RECORD; -- Captures Last record Number for looping
  	FIRST_RECORD;
	
	FOR X IN 1..V_LAST_RECORD LOOP
		
		GO_RECORD(X);
		GO_ITEM(V_ITEM_NAME);
		
		V_NEW_ITEM_VAL	:= NAME_IN('SYSTEM.CURRENT_VALUE');
		
	--	MESSAGE('V_NEW_ITEM_VAL:'||V_NEW_ITEM_VAL);MESSAGE(' ');
	--	MESSAGE('V_ITEM_VAL   :'||V_ITEM_VAL   );MESSAGE(' ');
				
		IF :SYSTEM.CURSOR_RECORD <> V_CURR_RECORD THEN
				IF	UPPER(V_NEW_ITEM_VAL)	=  UPPER(V_ITEM_VAL)   	THEN					
					MESSAGE('Duplicate Record Found ...!');message(' ');
					GO_RECORD(X);
					GO_ITEM(V_ITEM_NAME);
					V_ITEM_NAME := NULL;
					V_ITEM_VAL  := NULL;
					RAISE FORM_TRIGGER_FAILURE;
				END IF;
		END IF;
		
		GO_RECORD(V_CURR_RECORD);	-- IF NO DUPLICACY Then go to Same Record and Next Item
		GO_ITEM(V_ITEM_NAME);
		NEXT_ITEM;				
				
	END LOOP;	

EXCEPTION
	WHEN OTHERS THEN				
			NULL;
END CHECK_DUPLICATE_RECORD;



I have also attached a sample form for the same.
Re: Problem with Raise FORM_TRIGGER_FAILURE [message #381465 is a reply to message #381431] Sat, 17 January 2009 01:46 Go to previous messageGo to next message
javed.khan
Messages: 340
Registered: November 2006
Location: Banglore
Senior Member

Remove the Exception Handling part from your Program Unite. I thought its handling your Form Raise Trigger Failure and throwing you outside of loop because of that.

Javed
Re: Problem with Raise FORM_TRIGGER_FAILURE [message #381484 is a reply to message #381465] Sat, 17 January 2009 02:52 Go to previous messageGo to next message
rushimails
Messages: 24
Registered: November 2008
Location: Mumbai
Junior Member
Thanks Javed..
Re: Problem with Raise FORM_TRIGGER_FAILURE [message #381723 is a reply to message #381431] Mon, 19 January 2009 07:53 Go to previous message
parag_narkhede
Messages: 110
Registered: January 2008
Location: Pune
Senior Member
Is your problem got solved?

If no then I think,
You are restricting user just by key-next-item trigger. I think you should restrict user at on-commit trigger or any pre-insert at block level.



Previous Topic: Implicit Insert happening in form
Next Topic: Is there any way to get the source of Program Units from forms? (merged)
Goto Forum:
  


Current Time: Mon Dec 05 12:53:01 CST 2016

Total time taken to generate the page: 0.11313 seconds