Previous Topic

Next Topic

Message

Valid in: DBProc

The Message statement returns message text and a message number from a database procedure to an application program. The message statement can only be issued from a database procedure.

Previous Topic

Next Topic

Syntax

The Message statement has the following format:

MESSAGE message_text | message_number | message_number message_text

              [WITH DESTINATION =([SESSION][, ERROR_LOG] [, AUDIT_LOG]]);

To specify an action to be performed when an application receives a message from a database procedure, use the WHENEVER SQLMESSAGE statement. For details, see Whenever.

To specify a routine that is called when an application receives a message from a database procedure, use the SET_SQL(messagehandler) statement. For details, see Set_sql.

Previous Topic

Next Topic

Permissions

All users are permitted to use this statement.

Previous Topic

Next Topic

Related Statements

Create Procedure

Inquire_sql

Previous Topic

Next Topic

Examples: Message

The following are Message statement examples:

  1. The following example turns debugging text to the application.

    message 'Inserting new row';
        insert into tab values (:val);
        message 'About to commit change';
        commit;
        message 'Deleting newly inserted row';
        delete from tab where tabval = :val;
        message 'Returning with pending change';
        return;

  2. The following example returns a message number to the application. The application can extract the international message text out of a message file.

    if iierrornumber > 0 then
            message 58001;
        elseif iirowcount <> 1 then
            message 58002;
        endif;

  3. The following example sends a message to the error log file.

    message 'User attempting to update payroll table'
        with destination = (error_log);


© 2007 Ingres Corporation. All rights reserved.