您好,登錄后才能下訂單哦!
小編給大家分享一下Oracle高級隊列的示例分析,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
Oracle高級隊列(Advanced Queue)簡單實例
最簡單的高級隊列的練習(xí),基本上都使用了默認(rèn)參數(shù)。
-- Create Type create or replace type note as Object( subject varchar2(100), Content varchar2(2000),CreateTime date ); -- Create queue table begin sys.dbms_aqadm.create_queue_table( queue_table => 'NOTETAB', queue_payload_type => 'TEST.NOTE' end; --create queue begin 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; --enqueue declare v_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; --dequeue declare v_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 -- v_Recipients(0) := sys.aq$_agent('NOTE','MTQ',0); -- v_properties.recipient_list := v_Recipients; v_options.visibility :=DBMS_AQ.IMMEDIATE; dbms_aq.dequeue(queue_name => 'noteq',dequeue_options => v_options,message_properties => v_properties,payload => v_Message,msgid => v_MsgId); dbms_output.put_line('decode success,msgid is '||v_MsgId); dbms_output.put_line('subject is '||v_Message.subject); dbms_output.put_line('Content is '||v_Message.Content); dbms_output.put_line('createTime is '||to_char(v_Message.createTime,'yyyy-mm-dd hh34:mi:ss')); end;
以上是“Oracle高級隊列的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。