A script-enabled browser is required for this page to function properly.

When-Create-Record Trigger

Description

Fires when Oracle Forms creates a new record. For example, when the operator presses the [Insert] key, or navigates to the last record in a set while scrolling down, Oracle Forms fires this trigger.

Definition Level form or block

Legal Commands

SELECT statements, unrestricted Built-ins

Enter Query Mode no

Usage Notes

Use a When-Create-Record trigger to perform an action every time Oracle Forms attempts to create a new record. This trigger also is useful for setting complex, calculated, or data-driven default values that must be specified at runtime, rather than at design-time.

On Failure

Prevents the new record from being created. Returns to the previous location, if possible.

Fires In

CREATE_RECORD

When-Create-Record Trigger Examples

Example

This example assigns data-driven or calculated default values without marking the record as changed.

DECLARE
CURSOR ship_dflt IS SELECT val
FROM cust_pref
WHERE Custid = :Customer.Custid
AND pref = 'SHIP';
BEGIN
/*
** Default Invoice Due Date based on Customer's
** Net Days Allowed value from the Customer block.
*/
:Invoice.Due_Date := SYSDATE + :Customer.Net_Days_Allowed;
/*
** Default the shipping method based on this customers
** preference, stored in a preference table. We could
** use SELECT...INTO, but explicit cursor is more
** efficient.
*/
OPEN ship_dflt;
FETCH ship_dflt INTO :Invoice.Ship_Method;
CLOSE ship_dflt;
END;


CREATE_RECORD Built-in