2 Replies Latest reply on Feb 19, 2012 2:23 PM by 840912

    How to pass multiple  records in  queue

    840912
      Hi Guys,

      I have created a Queue in Oracle below is the code

      In this code My pass one record at a time

      My question is how to pass multiple records a time

      Please suggest me how to pass multiple records in one short






      --------------------------------------------------------------------------------

      CREATE OR REPLACE TYPE SCOTT.demo_queue_payload_type AS OBJECT
      (
      empno number(10),
      ename varchar2(5),
      sal number(10),
      Job varchar2(25),
      deptno number(5)
      );
      /

      ============================================================================
      BEGIN
      DBMS_AQADM.CREATE_QUEUE_TABLE (
      queue_table => 'demo_queue_table2',
      queue_payload_type => 'demo_queue_payload_type1'
      );
      END;


      ===============================================================================
      BEGIN


      DBMS_AQADM.CREATE_QUEUE (
      queue_name => 'demo_queue2',
      queue_table => 'demo_queue_table2'
      );


      DBMS_AQADM.START_QUEUE (
      queue_name => 'demo_queue2'
      );


      END;
      ================================================================================
      DECLARE


      r_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
      r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
      v_message_handle RAW(16);
      o_payload demo_queue_payload_type1;


      BEGIN




      o_payload :=demo_queue_payload_type1(101,'Smith',10000,'NJ',10);


      DBMS_AQ.ENQUEUE(
      queue_name => 'demo_queue2',
      enqueue_options => r_enqueue_options,
      message_properties => r_message_properties,
      payload => o_payload,
      msgid => v_message_handle
      );


      COMMIT;


      END;
      =================================================================================
      SELECT * FROM aq$demo_queue_table2;