Oracle Advanced Queue First Experience

xiaoxiao2021-04-07  293

The easiest advanced queue exercises are basically used by default parameters. - Create TypeCreate or Replace Type Note As Object (Subject Varchar2 (100), Content Varchar2 (2000), CreateTime Date;

- Create Queue TableBegin Sys.dbms_aqadm.create_queue_table (queue_table => 'NOTETAB', Queue_Payload_Type => 'Test.note'END;

--create queuebegin sys.dbms_aqadm.create_queue (queue_name => 'NOTEQ', queue_table => 'NOTETAB', queue_type => sys.dbms_aqadm.normal_queue, max_retries => 5, retry_delay => 0, retention_time => 0); end ;

--enqueuedeclarev_Message note; v_MsgId RAW (16); v_options DBMS_AQ.ENQUEUE_OPTIONS_T; v_properties DBMS_AQ.MESSAGE_PROPERTIES_T; v_Recipients DBMS_AQ.AQ $ _RECIPIENT_LIST_T; begin v_Message: = note (subject => 'note3', Content => 'content3', createTime = > sysdate);

- v_Recipients (0): = sys.aq $ _agent ( 'NOTE', 'MTQ', 0); - v_properties.recipient_list: = v_Recipients; v_options.visibility: = DBMS_AQ.IMMEDIATE; dbms_aq.enqueue (queue_name => 'noteq', enqueue_options => v_options, message_properties => v_properties, payload => v_Message, msgid => v_MsgId); dbms_output.put_line ( 'encode success, msgid is' || v_MsgId);

END;

--dequeuedeclarev_Message note; v_MsgId RAW (16); v_options DBMS_AQ.DEQUEUE_OPTIONS_T; v_properties DBMS_AQ.MESSAGE_PROPERTIES_T; v_Recipients DBMS_AQ.AQ $ _RECIPIENT_LIST_T; begin

转载请注明原文地址:https://www.9cbs.com/read-132400.html

New Post(0)