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.

MESSAGE_CODE built-in<br />

Description<br />

Returns a message number for the message that <strong>Form</strong> <strong>Builder</strong> most recently generated during the current<br />

Runform session. MESSAGE_CODE returns zero at the beginning of a session, before <strong>Form</strong> <strong>Builder</strong><br />

generates any messages.<br />

Use MESSAGE_CODE to test the outcome of a user action (e.g., pressing a key) to determine<br />

processing within an On-Message trigger.<br />

Refer to the Messages appendix for a list of messages and message numbers.<br />

Syntax<br />

FUNCTION MESSAGE_CODE;<br />

Built-in Type unrestricted function<br />

Returns NUMBER<br />

Enter Query Mode yes<br />

Parameters<br />

none<br />

MESSAGE_CODE examples<br />

/*<br />

** Built-in: MESSAGE_CODE,MESSAGE_TEXT,MESSAGE_TYPE<br />

** Example: Reword certain FRM message messages by checking<br />

** the Message_Code in an ON-MESSAGE trigger<br />

** trigger: On-Message<br />

*/<br />

DECLARE<br />

msgnum NUMBER := MESSAGE_CODE;<br />

msgtxt VARCHAR2(80) := MESSAGE_TEXT;<br />

msgtyp VARCHAR2(3) := MESSAGE_TYPE;<br />

BEGIN<br />

IF msgnum = 40400 THEN<br />

Message(’Your changes have been made permanent.’);<br />

ELSIF msgnum = 40401 THEN<br />

Message(’You have no unsaved changes outstanding.’);<br />

ELSE<br />

/*<br />

** Print the Normal Message that would have appeared<br />

**<br />

** FRM-12345: Message Text Goes Here<br />

*/<br />

Message(msgtyp||’-’||TO_CHAR(msgnum)||’: ’||msgtxt);<br />

END IF;<br />

END;<br />

285

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

Saved successfully!

Ooh no, something went wrong!