You are developing a Human Resourced form with a single block to display employees. For each employee, you look up the department name to display in a non-base-table item. When you test the form, you discover that when you enter a new employee as the first employee in a new department that has not yet been created in the database, you get the following error when you try to navigate out of the Department_Id item:
FRM-40735: WHEN-VALIDATE-ITEM trigger raised unhandled exception ORA-01403.
The ORA-01403 exception is the NO_DATA_FOUND exception. When this message is received, you cannot navigate out of the Department_Id item. You add the following code to the When-Validate-Item trigger on the Department_Id item to display a meaningful message to the use:
EXCEPTION
WHEN NO_DATA_FOUND THEN
MESSAGE(‘You must create the department before adding employees to it’); You run the form again to test it, and you enter a new employee and a department ID that does not exist in the database. When you click into the Employee_Name Item, the appropriate message is displayed, but the cursor moves to Employee_Name. What must you change so that the user will not be able to navigate out of the Department_Id item when entering a department ID that is no in the database?
A.
If you write a handler for the exception, you will not be able to stop navigation from occurring, so you should put the following code in an On-Error trigger instead:
IF ERROR_CODE = 40735 THEN
MESSAGE(‘You must create the department before adding employees to it’); END IF;
B.
Add the following code at the end of the exception handler:
IF DBMS_ERROR_CODE = 1403 THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;
C.
Add the following line at the end of the exception handler:
RAISE FORM_TRIGGER_FAILURE;
D.
If you write a handler for the exception, you will not be able to stop navigation from occurring.
Instead, create a Key-Next-Item trigger on the Department_Id item with the following code:
NEXT_ITEM
IF NOT FORM_SUCCESS THEN
MESSAGE(‘You must create the department before adding employees to it’); END IF;
E.
You cannot stop navigation from occurring when displaying a custom message.
You should delete the exception handler and allow Forms to display the default message.