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.

DBMS_ERROR_TEXT built-in<br />

Description<br />

72<br />

Returns the message number (such as ORA-01438) and message text of the database error.<br />

Syntax<br />

FUNCTION DBMS_ERROR_TEXT;<br />

Built-in Type unrestricted function<br />

Enter Query Mode yes<br />

Parameters<br />

none<br />

Usage Notes<br />

You can use this function to test database error messages during exception handling routines.<br />

DBMS_ERROR_TEXT returns the entire sequence of recursive errors.<br />

DBMS_ERROR_TEXT examples<br />

/*<br />

** Built-in: DBMS_ERROR_CODE,DBMS_ERROR_TEXT<br />

** Example: Reword certain <strong>Form</strong> <strong>Builder</strong> error messages by<br />

** evaluating the DBMS error code that caused them<br />

** trigger: On-Error<br />

*/<br />

DECLARE<br />

errcode NUMBER := ERROR_CODE;<br />

dbmserrcode NUMBER;<br />

dbmserrtext VARCHAR2(200);<br />

BEGIN<br />

IF errcode = 40508 THEN<br />

/*<br />

** <strong>Form</strong> <strong>Builder</strong> had a problem INSERTing, so<br />

** look at the Database error which<br />

** caused the problem.<br />

*/<br />

dbmserrcode := DBMS_ERROR_CODE;<br />

dbmserrtext := DBMS_ERROR_TEXT;<br />

IF dbmserrcode = -1438 THEN<br />

/*<br />

** ORA-01438 is "value too large for column"<br />

*/<br />

Message(’Your number is too large. Try again.’);<br />

ELSIF dbmserrcode = -1400 THEN<br />

/*<br />

** ORA-01400 is "Mandatory column is NULL"<br />

*/<br />

Message(’You forgot to provide a value. Try again.’);<br />

ELSE<br />

/*

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

Saved successfully!

Ooh no, something went wrong!