Oracle PL/SQL Tutorial/System Packages/DBMS AQ

Материал из SQL эксперт
Перейти к: навигация, поиск

DBMS_AQ.ENQUEUE_OPTIONS_T

SQL>
SQL> create or replace type myTable as object (
  2      msg_identifier  VARCHAR2(25),
  3      msg_body        VARCHAR2(100),
  4      msg_date        DATE);
  5  /

SQL>
SQL>
SQL> DECLARE
  2      v_msg       myTable;
  3      v_enqopts   DBMS_AQ.ENQUEUE_OPTIONS_T;
  4      v_msg_prop  DBMS_AQ.MESSAGE_PROPERTIES_T;
  5      v_msgid RAW(16);
  6      v_ctr       INTEGER ;
  7  BEGIN
  8      FOR v_ctr IN 1..10 LOOP
  9        v_msg := myTable("Message "|| v_ctr,
 10               "test message data "|| v_ctr, sysdate) ;
 11        DBMS_AQ.ENQUEUE(queue_name => "test_q",
 12          enqueue_options => v_enqopts,
 13          message_properties => v_msg_prop,
 14          payload => v_msg,
 15          msgid => v_msgid);
 16      END LOOP ;
 17      COMMIT;
 18  END ;
 19  /
PL/SQL procedure successfully completed.