Đang chuẩn bị liên kết để tải về tài liệu:
Oracle Built−in Packages- P55
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Oracle Built−in Packages- P55: Ah, for the good old days of Version 1.0 of PL /SQL! Life was so simple then. No stored procedures or functions and certainly no packages. You had your set of built−in functions, like SUBSTR and TO_DATE. You had the IF statement and various kinds of loops. With these tools at hand, you built your batch−processing scripts for execution in SQL*Plus, and you coded your triggers in SQL*Forms 3.0, and you went home at night content with a good day's work done. | Appendix A What s on the Companion Disk DECLARE mymsgid aq.msgid_type Are you curious about those message IDs When I ran the previous script I also asked PL SQL to display the msgid value with the following statement DBMS_OUTPUT.PUT_LINE RAWTOHEX msgid and this is what I saw E2CEA14B51F411D1B977E59CD6EE8E46 That is certainly a mouthful. When would you use this ID Well I can go right back to the data dictionary and ask to see all the information about this message. Every time you create a queue table Oracle AQ creates an underlying database view with the name aq queue_table_name . So if I created a queue table named msg I should be able to examine the contents of a table called aq msg in my own schema. I put together a little SQL Plus script to show the status and user data for a message Filename on companion disk aqshomsg.sql SELECT msg_state user_data FROM aq 1 WHERE msg_id HEXTORAW 2 I can then call this script in SQL Plus to show me the information about the just-queued message as follows SQL @aqshomsg msg E2CEA14B51F411D1B977E59CD6EE8E46 MSG_STATE USER_DATA TITLE TEXT READY MESSAGE_TYPE First Enqueue May there be many more. Notice that the query automatically detected the fact that my user_data is in fact an object and showed me the full contents of that object quite neatly. You can of course also see other attributes of the message see the later section entitled Section 5.6 for more details on this table and how best to retrieve information from it. Of course you will sometimes want to modify the message properties or enqueue options before performing your enqueue. To do this simply change the values of the fields in the record. The following example shows how you can delay the availability of a message for dequeuing by three days and also request that one message be dequeued before another Filename on companion disk aqenq2.sql DECLARE queueopts DBMS_AQ.ENQUEUE_OPTIONS_T msgprops DBMS_AQ.MESSAGE_PROPERTIES_T msgidl aq.msgid_type msgid2 aq.msgid_type my_msg .