11.01.2013 Views

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When-Validate-Item trigger<br />

Description<br />

Fires during the Validate the Item process. Specifically, it fires as the last part of item validation for<br />

items with the New or Changed validation status.<br />

Definition Level form, block, or item<br />

Legal Commands<br />

SELECT statements, unrestricted built-ins<br />

Enter Query Mode no<br />

Usage Notes<br />

• Use a When-Validate-Item trigger to supplement <strong>Form</strong> <strong>Builder</strong> default item validation processing.<br />

• It is possible to write a When-Validate-Item trigger that changes the value of an item that <strong>Form</strong><br />

<strong>Builder</strong> is validating. If validation succeeds, <strong>Form</strong> <strong>Builder</strong> marks the changed item as Valid and<br />

does not re-validate it. While this behavior is necessary to avoid validation loops, it does make it<br />

possible for your application to commit an invalid value to the database.<br />

• The setting you choose for the Defer Required Enforcement property can affect the When-Validate-<br />

Item trigger. See Defer_Required_Enforcement for details.<br />

On Failure<br />

If fired as part of validation initiated by navigation, navigation fails, and the focus remains on the<br />

original item.<br />

Fires In<br />

Validate the Item<br />

See Process Flowcharts<br />

When-Validate-Item trigger examples<br />

Example<br />

The following example finds the commission plan in the COMMPLAN<br />

table, based on the current value of the commcode item in the<br />

EMPLOYEE block in the form, to verify that the code is valid.<br />

If the code in the COMMPLAN table is located, the description of<br />

the COMMPLAN is obtained and deposited in the non-database<br />

Description item. Otherwise, an error is raised.<br />

** Method 1: Using a SELECT...INTO statement, the trigger<br />

** looks more readable but can be less efficient<br />

** than Method 2 because for ANSI Standard<br />

** compliance, the SELECT...INTO statement must<br />

** return an error if more than one row is<br />

** retrieved that matches the criteria. This<br />

** implies PL/SQL may attempt to fetch data twice<br />

531

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!