Oracle高级队列(Advanced Queue)简单实例
程序员文章站
2022-04-23 20:05:50
oracle高级队列(advanced queue)简单实例
最简单的高级队列的练习,基本上都使用了默认参数。
-- create type
create...
oracle高级队列(advanced queue)简单实例
最简单的高级队列的练习,基本上都使用了默认参数。
-- 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 hh24:mi:ss')); end;
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
下一篇: 网络营销中真正的搜索竞价操作法则是什么?