Search code examples
oracleplsqlxmltypeora-06550advanced-queuing

Dequeinf XMLTYPE message throws error


I have the following code which is for dequeuing data from AQ

DECLARE
   dequeue_options     dbms_aq.dequeue_options_t;
   message_properties  dbms_aq.message_properties_t;
   message_handle      RAW(16);
   message             SYS.XMLTYPE;

  BEGIN
      DBMS_AQ.DEQUEUE(queue_name => 'my_demo_queue',
       dequeue_options    => dequeue_options,
       message_properties => message_properties,
       payload            => message,
       msgid              => message_handle);

     DBMS_OUTPUT.PUT_LINE ('Message: ' || message);
  COMMIT;
END;

After executing its giving me the following error -

Error report - ORA-06550: line 14, column 30: PLS-00306: wrong number or types of arguments in call to '||' ORA-06550: line 14, column 8: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:

I have used the above block for different payload type and it worked fine, but when I am using XMLTYPE as payload I am getting this problem.

I have tried the above block with XMLTYPE payload without using DBMS_OUTPUT.PUT_LINE ('Message: ' || message); and it worked perfectly.

Where I am making the mistake?


Solution

  • DBMS_OUTPUT.PUT_LINE ('Message: ' || message.getClobVal() ); 
    or
    DBMS_OUTPUT.PUT_LINE ('Message: ' || message.getStringVal() );