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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Pre-Insert trigger<br />

Description<br />

Fires during the Post and Commit Transactions process, before a row is inserted. It fires once for each<br />

record that is marked for insert.<br />

Definition Level form or block<br />

Legal Commands<br />

SELECT statements, DML statements (DELETE, INSERT, UPDATE), unrestricted built-ins<br />

Enter Query Mode no<br />

Usage Notes<br />

Use a Pre-Insert trigger to perform the following tasks:<br />

• change item values<br />

• keep track of the date a record is created and store that in the record prior to committing<br />

On Failure<br />

<strong>Form</strong> <strong>Builder</strong> performs the following steps when the Pre-Insert trigger fails:<br />

• sets the error location<br />

• rolls back to the most recent savepoint<br />

Fires In<br />

Post and Commit Transactions<br />

See Process Flowcharts<br />

Pre-Insert trigger examples<br />

Example<br />

This example assigns a primary key field based on a sequence number, and then writes a row into an<br />

auditing table, flagging creation of a new order.<br />

DECLARE<br />

CURSOR next_ord IS SELECT orderid_seq.NEXTVAL FROM dual;<br />

BEGIN<br />

482<br />

/*<br />

** Fetch the next sequence number from the<br />

** explicit cursor directly into the item in<br />

** the Order record. Could use SELECT...INTO,<br />

** but explicit cursor is more efficient.<br />

*/<br />

OPEN next_ord;<br />

FETCH next_ord INTO :Order.OrderId;

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

Saved successfully!

Ooh no, something went wrong!