dequeuearray

mail@pastecode.io avatar
unknown
sql
a year ago
1.3 kB
2
Indexable
Never
PROCEDURE dequeuearray(queuename in varchar2, arMsg out BSMS_MSG_ARRAY, arSize out int)
is
r_dequeue_options DBMS_AQ.DEQUEUE_OPTIONS_T;
nt_msg_properties DBMS_AQ.MESSAGE_PROPERTIES_ARRAY_T;
nt_msg_ids        DBMS_AQ.MSGID_ARRAY_T;
v_dequeued_cnt    int;
v_dequeue_size    int;
v_Error varchar2(200);
  v_th    boolean;
begin
/* Prepare collections... */
v_dequeue_size:=40;
arMsg:=BSMS_MSG_ARRAY();
arMsg.EXTEND(v_dequeue_size);
nt_msg_properties := DBMS_AQ.MESSAGE_PROPERTIES_ARRAY_T();
nt_msg_properties.EXTEND(v_dequeue_size);
nt_msg_ids := DBMS_AQ.MSGID_ARRAY_T();

/* Dequeue 40 messages... */
v_dequeued_cnt := DBMS_AQ.DEQUEUE_ARRAY(
               queue_name               => queuename,
              dequeue_options          => r_dequeue_options,
                array_size               => v_dequeue_size,
             message_properties_array => nt_msg_properties,
                payload_array            => arMsg,
               msgid_array              => nt_msg_ids
                     );

   COMMIT;
   arSize:=v_dequeued_cnt;
exception
  when others then
    RollBack;
    v_Error := substr(sqlerrm, 1, 200);
    v_th    := commonfunctions_pkg.ghi_loi(v_Error + ' createMsgLCNew');
    arMsg.Delete;
    arSize:=-1;
end;