sa_server_messages system procedure

Allows you to return messages from the database server messages window as a result set.

Syntax
sa_server_messages( [ first_msg ] [, num_msgs ] )
Arguments
  • first_msg   Use this optional UNSIGNED BIGINT parameter to specify the ID of the first or last message to be returned, depending on the sign of the num_msgs parameter. The default is NULL, which means that the search starts at the beginning of the list if num_msgs is NULL or non-negative; the search starts past the end of the list if num_msgs is negative.

  • num_msgs   Use this optional BIGINT parameter to specify the number of messages to be returned. The sign indicates whether the request is for messages starting at first_msg or ending at first_msg. The default is NULL, which means that all messages starting at first_msg to the end of the list are returned.

Result set
Column name Data type Description
msg_id UNSIGNED BIGINT Unique message ID. Message IDs start at 0.
msg_text LONG VARCHAR Message text.
msg_time TIMESTAMP Time when the message was issued.
msg_severity VARCHAR(255)

Message severity. This column contains one of the following values:

  • INFO   Informational message.

  • WARN   Warning.

  • ERR   Error.

msg_category VARCHAR(255)

Message category. This column contains one of the following values:

  • STARTUP   Messages related to database server or database startup or shutdown.

  • CHKPT   Messages related to checkpoints.

  • MSG   Messages generated using the MESSAGE or PRINT statements.

  • DBA_MSG   Messages generated using the MESSAGE statement that would have required DBA permissions, such as messages sent to the event log.

  • CONN   Messages about database server connectivity.

  • OTHER   All other types of messages.

msg_database VARCHAR(255) Database name associated with the message if it applies to one specific database. Otherwise, NULL.
Remarks

When new messages are sent to the console, old messages with the same category or severity are deleted if the number of messages exceeds the value of the MessageCategoryLimit property. As a result, there may be gaps in the result set, and two consecutive rows may not have consecutive message IDs.

Permissions

None

Side effects

None

See also
Example

The following command requests 100 messages starting at the message whose ID is 3:

CALL sa_server_messages( 3, 100 );

The following command requests 500 messages up to, and including, message 4032:

CALL sa_server_messages( 4032, -500 );

The following commands request all messages starting with message 3:

CALL sa_server_messages( 3, NULL );
CALL sa_server_messages( 3 );

The following command requests the first 100 messages in the list:

CALL sa_server_messages( NULL, 100 );

The following command requests the last 100 messages in the list:

CALL sa_server_messages( NULL, -100 );

The following commands request all the messages in the list:

CALL sa_server_messages( NULL, NULL );
CALL sa_server_messages( );