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.

Usage Notes<br />

118<br />

NO_ROLLBACK <strong>Form</strong> <strong>Builder</strong> exits the current form without rolling<br />

back to a savepoint. You can leave the top level form without performing a<br />

rollback, which means that you retain the locks across a NEW_FORM<br />

operation. These locks can also occur when running <strong>Form</strong> <strong>Builder</strong> from an<br />

external 3GL program. The locks remain in effect when <strong>Form</strong> <strong>Builder</strong><br />

returns control to the program.<br />

Because the default parameters of EXIT_FORM are ASK_COMMIT for commit_mode and<br />

TO_SAVEPOINT for rollback_mode, invoking EXIT_FORM without specifying any parameters in<br />

some contexts may produce undesired results. For example, if the form is in POST only mode and<br />

EXIT_FORM is invoked without parameters, the user will be prompted to commit the changes.<br />

However, regardless of the user’s input at that prompt, the default rollback_mode of TO_SAVEPOINT<br />

rolls back the changes to the form despite a message confirming that changes have been made. To avoid<br />

conflicts explicitly specify parameters.<br />

EXIT_FORM examples<br />

/*<br />

** Built-in: EXIT_FORM and POST<br />

** Example: Leave the called form, without rolling back the<br />

** posted changes so they may be posted and<br />

** committed by the calling form as part of the<br />

** same transaction.<br />

*/<br />

BEGIN<br />

Post;<br />

/*<br />

** <strong>Form</strong>_Status should be ’QUERY’ if all records were<br />

** successfully posted.<br />

*/<br />

IF :System.<strong>Form</strong>_Status ’QUERY’ THEN<br />

Message(’An error prevented the system from posting<br />

changes’);<br />

RAISE <strong>Form</strong>_trigger_Failure;<br />

END IF;<br />

/*<br />

** By default, Exit_<strong>Form</strong> asks to commit and performs a<br />

** rollback to savepoint. We’ve already posted, so we do<br />

** not need to commit, and we don’t want the posted changes<br />

** to be rolled back.<br />

*/<br />

Exit_<strong>Form</strong>(NO_COMMIT, NO_ROLLBACK);<br />

END;

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

Saved successfully!

Ooh no, something went wrong!