DB2 Version 9.7 for Linux, UNIX, and Windows

MQREADCLOB scalar function

The MQREADCLOB function returns a message from the MQSeries® location specified by receive-service, using the quality of service policy defined in service-policy. Executing this operation does not remove the message from the queue associated with receive-service, but instead returns the message at the head of the queue.

The data type of the result is CLOB(1M). If no messages are available to be returned, the result is the null value.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-MQREADCLOB--(--+----------------------------------------+---->
                  '-receive-service--+-------------------+-'   
                                     '-,--service-policy-'     

>--)-----------------------------------------------------------><

The schema is DB2MQ.

Function parameters

receive-service
A string containing the logical MQSeries destination from where the message is to be received. If specified, the receive-service must refer to a Service Point defined in the DB2MQ.MQSERVICE table. A service point is a logical end-point from where a message is sent or received. Service points definitions include the name of the MQSeries Queue Manager and Queue. If receive-service is not specified, then the DB2.DEFAULT.SERVICE will be used. The maximum size of receive-service is 48 bytes.
service-policy
A string containing the MQSeries Service Policy used in handling this message. If specified, the service-policy must refer to a Policy defined in the DB2MQ.MQPOLICY table. A Service Policy defines a set of quality of service options that should be applied to this messaging operation. These options include message priority and message persistence. If service-policy is not specified, then the default DB2.DEFAULT.POLICY will be used. The maximum size of service-policy is 48 bytes.

Authorization

One of the following authorities is required to execute the function:
  • EXECUTE privilege on the function
  • DATAACCESS authority
  • DBADM authority
  • SQLADM authority

Examples

Example 1: This example reads the message at the head of the queue specified by the default service (DB2.DEFAULT.SERVICE), using the default policy (DB2.DEFAULT.POLICY).
   VALUES MQREADCLOB()
Example 2: This example reads the message at the head of the queue specified by the service "MYSERVICE" using the default policy (DB2.DEFAULT.POLICY).
   VALUES MQREADCLOB('MYSERVICE')
Example 3: This example reads the message at the head of the queue specified by the service "MYSERVICE", and using the policy "MYPOLICY".
   VALUES MQREADCLOB('MYSERVICE','MYPOLICY')