HP 3000 Manuals

User Defined Messages [ ALLBASE/SQL Message Manual ] MPE/iX 5.5 Documentation


ALLBASE/SQL Message Manual

User Defined Messages 

Two statements permit you to create your own messages in ALLBASE/SQL
procedures and applications:

   *   RAISE ERROR
   *   PRINT

RAISE ERROR 

The RAISE ERROR statement permits users to define their own message
catalogs.  The number range 7000 - 7999 is reserved for use in RAISE
ERROR. No errors in this range will be generated by ALLBASE/SQL.

Each error caused by the RAISE ERROR statement is a regular error that
generates a message placed in the message buffer.  A raised error halts
the execution of a rule, if issued within a procedure invoked by a rule.
A raised error does not cause transaction rollback or disconnection from
the DBEnvironment.

Any use of this statement will generate an error.  The error number
returned in SQLCODE will be the specified error number or, if none is
specified, the default error number (2350).  The error text returned will
be the error text specified.  If no text is specified, then no text is
returned.  Messages stored in the message buffer are available to
application programs through the use of the SQLEXPLAIN statement.  Inside
application programs, test SQLCODE, and if its value is less than zero,
use SQLEXPLAIN to retrieve messages stored in the message buffer.
SQLEXPLAIN cannot be used inside procedures.

The RAISE ERROR statement can be used to override the existing message
catalog if the user issues this statement with an existing error number
defined in this manual.  However, if existing warning numbers are used,
raised errors are not treated as warnings; they are always treated as
errors.

You should define the action a user should take for each error number
used with RAISE ERROR. You can do this by including an explanation in the
error text itself or in external documentation.  Refer to the ALLBASE/SQL 
Reference Manual for additional information on using the RAISE ERROR
statement.

PRINT 

The PRINT statement, available only inside procedures, lets you place
informational messages in the message buffer.  PRINT is intended for
informational messages that have the status of warnings (though no actual
warning may be intended).  No numbers are assigned in the PRINT
statement.  Inside application programs, test SQLWARN0 for a value of
'W', and if this condition is true, use SQLEXPLAIN to retrieve messages
stored in the message buffer.  Refer to the ALLBASE/SQL Reference Manual 
for additional information on using the PRINT statement.



MPE/iX 5.5 Documentation