1. Trang chủ
  2. » Công Nghệ Thông Tin

Oracle PLSQL Language- P28

50 302 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 50
Dung lượng 171,54 KB

Nội dung

The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates. All rights reserved. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Previous: C.2 DBMS_ALERT Appendix C Built-In Packages Next: C.4 DBMS_DDL C.3 Oracle AQ, the Advanced Queueing Facility Oracle8 offers the Oracle Advanced Queuing facility (Oracle AQ) which implements deferred execution of work. There are two packages you will use to implement advanced queuing: DBMS_AQ, which contains the queuing procedures themselves, and DBMS_AQADM, which lets you perform administrative tasks. They make extensive use of PL/SQL record structures, as you will see in the individual program interfaces below. For more detail on these records and how to manipulate their contents, see Oracle Built-in Packages. C.3.1 DBMS_AQ (PL/SQL 8 Only) The DBMS_AQ package provides an interface to the messaging tasks of Oracle AQ. To use these procedures, you must have been granted the new role, AQ_USER_ROLE. C.3.1.1 The ENQUEUE procedure The ENQUEUE procedure adds a message to an existing message queue. The target message queue must have had enqueuing enabled previously via the DBMS_ AQADM.START_QUEUE procedure. The specification is: PROCEDURE DBMS_AQ.ENQUEUE (q_schema IN VARCHAR2 DEFAULT NULL q_name IN VARCHAR2, corrid IN VARCHAR2 DEFAULT NULL, transactional IN BOOLEAN:= TRUE, priority IN POSITIVE DEFAULT 1, delay IN DATE DEFAULT NULL, expiration IN NATURAL:= 0, relative_msgid IN NUMBER DEFAULT NULL, seq_deviation IN CHAR DEFAULT A, exception_queue_schema IN VARCHAR2 DEFAULT NULL, exception_queue IN VARCHAR2 DEFAULT NULL, Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. reply_queue_schema IN VARCHAR2 DEFAULT NULL, reply_queue IN VARCHAR2 DEFAULT NULL, user_data IN any_object_type, msgid OUT RAW); C.3.1.2 The DEQUEUE procedure The DEQUEUE procedure can either remove or browse a message from an existing message queue. The target message queue must have had dequeuing enabled previously via the DBMS_AQADM. STOP_QUEUE procedure. The specification is: PROCEDURE DBMS_AQ.DEQUEUE (q_schema IN VARCHAR2 DEFAULT NULL, q_name IN VARCHAR2, msgid IN RAW DEFAULT NULL, corrid IN VARCHAR2 DEFAULT NULL, deq_mode IN CHAR DEFAULT `D', wait_time IN NATURAL DEFAULT NULL, transactional IN BOOLEAN:= true, out_msgid OUT NUMBER, out_corrid OUT VARCHAR2, priority OUT POSITIVE, delay OUT DATE, expiration OUT NATURAL, retry OUT NATURAL, exception_queue_schema OUT VARCHAR2, exception_queue OUT VARCHAR2, reply_queue_schema OUT VARCHAR2, reply_queue OUT VARCHAR2, user_data OUT any_object_type); C.3.2 DBMS_AQADM (PL/SQL 8 Only) The DBMS_AQADM package provides an interface to the administrative tasks of Oracle AQ. To use these procedures, a DBMS_AQADM user must have been granted the new role, AQ_ADMINISTRATOR_ROLE. You can verify the results of executing the DBMS_ AQADM package by querying the new Oracle AQ data dictionary views, USER_QUEUE_ TABLES and USER_QUEUES (DBA levels of these views are also available). C.3.2.1 The CREATE_QUEUE_TABLE procedure Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. The CREATE_QUEUE_TABLE procedure creates a queue table. A queue table is the named repository for a set of queues and their messages. A queue table may contain numerous queues, each of which may have many messages. But a given queue and its messages may exist in only one queue table. The specification is: PROCEDURE DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table IN VARCHAR2 ,queue_payload_type IN VARCHAR2 ,storage_clause IN VARCHAR2 DEFAULT NULL ,sort_list IN VARCHAR2 DEFAULT NULL ,multiple_consumers IN BOOLEAN DEFAULT FALSE ,message_grouping IN BINARY_INTEGER DEFAULT NONE ,comment IN VARCHAR2 DEFAULT NULL ,auto_commit IN BOOLEAN DEFAULT TRUE); C.3.2.2 The DROP_QUEUE_TABLE procedure The DROP_QUEUE_TABLE procedure drops an existing queue table. An error is returned if the queue table does not exist. The force parameter specifies whether all existing queues in the queue table are stopped and dropped automatically or manually. If manually (i.e., FALSE), then the queue administrator must stop and drop all existing queues within the queue table using the DBMS_AQADM.STOP_QUEUE and DBMS_AQADM.DROP_QUEUE procedures. The specification is: PROCEDURE DBMS_AQADM.DROP_QUEUE_TABLE (queue_table IN VARCHAR2, force IN BOOLEAN default FALSE, auto_commit IN BOOLEAN default TRUE); C.3.2.3 The CREATE_QUEUE procedure The CREATE_QUEUE procedure creates a new message queue within an existing queue table. An error is returned if the queue table does not exist. The required queue_name parameter specifies the name of the new message queue to create. All queue names must be unique within the schema. The specification is: PROCEDURE DBMS_AQADM.CREATE_QUEUE (queue_name IN VARCHAR2, queue_table IN VARCHAR2, queue_type IN BINARY_INTEGER default DBMS_AQADM. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. NORMAL_QUEUE, max_retries IN NUMBER default 0, retry_delay IN NUMBER default 0, retention_time IN NUMBER default 0, dependency_tracking IN BOOLEAN default FALSE, comment IN VARCHAR2 default NULL, auto_commit IN BOOLEAN default TRUE); C.3.2.4 The ALTER_QUEUE procedure The ALTER_QUEUE procedure modifies properties of an existing message queue. It returns an error if the message queue does not exist. Currently, you can alter only the maximum retries, retry delay, retention time, rentention delay and auto-commit properties; Oracle will augment this list in future releases. The specification is: PROCEDURE DBMS_AQADM.ALTER_QUEUE ( queue_name IN VARCHAR2, max_retries IN NUMBER default NULL, retry_delay IN NUMBER default NULL, retention_time IN NUMBER default NULL, auto_commit IN BOOLEAN default TRUE); C.3.2.5 The DROP_QUEUE procedure The DROP_QUEUE procedure drops an existing message queue. It returns an error if the message queue does not exist. DROP_QUEUE is not allowed unless STOP_QUEUE has been called to disable both enqueuing and dequeuing for the message queue to be dropped. If the message queue has not been stopped, then DROP_QUEUE returns an error of queue resource busy. The specification is: PROCEDURE DBMS_AQADM.DROP_QUEUE_TABLE (queue_table IN VARCHAR2, force IN BOOLEAN default FALSE, auto_commit IN BOOLEAN default TRUE); C.3.2.6 The START_QUEUE procedure The START_QUEUE procedure enables an existing message queue for enqueuing and dequeuing. It returns an error if the message queue does not exist. The default is to enable both. The specification is: Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. PROCEDURE DBMS_AQADM.START_QUEUE ( queue_name IN VARCHAR2, enqueue IN BOOLEAN DEFAULT TRUE, dequeue IN BOOLEAN DEFAULT TRUE); C.3.2.7 The STOP_QUEUE procedure The STOP_QUEUE procedure disables an existing message queue for enqueuing and dequeuing. It returns an error if the message queue does not exist. The default is to disable both enqueuing and dequeuing. The wait parameter specifies whether to wait for outstanding transactions or to return immediately. The wait option is highly dependent on outstanding transactions. If outstanding transactions exist, then wait will either hang until the transactions complete or return an error of ORA- 24203, depending on whether the wait parameter is set to true or false. The specification is: PROCEDURE DBMS_AQADM.STOP_QUEUE (queue_name IN VARCHAR2, enqueue IN BOOLEAN DEFAULT TRUE, dequeue IN BOOLEAN DEFAULT TRUE, wait IN BOOLEAN DEFAULT TRUE); Previous: C.2 DBMS_ALERT Oracle PL/SQL Programming, 2nd Edition Next: C.4 DBMS_DDL C.2 DBMS_ALERT Book Index C.4 DBMS_DDL The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates. All rights reserved. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Previous: C.3 Oracle AQ, the Advanced Queueing Facility Appendix C Built-In Packages Next: C.5 DBMS_ JOB C.4 DBMS_DDL The DBMS_DDL package provides access to some of the SQL DDL statements from within stored procedures. C.4.1 The ALTER_COMPILE procedure The ALTER_COMPILE procedure can be used to programmatically force a recompile of a stored object. The specification is: PROCEDURE DBMS_DDL.ALTER_COMPILE (type VARCHAR2, schema VARCHAR2, name VARCHAR2); C.4.2 The ANALYZE_OBJECT procedure A call to ANALYZE_OBJECT lets you programmatically compute statistics for the specified object. The specification is: PROCEDURE DBMS_DDL.ANALYZE_OBJECT (type VARCHAR2, schema VARCHAR2, name VARCHAR2, method VARCHAR2, estimate_rows NUMBER DEFAULT NULL, estimate_percent NUMBER DEFAULT NULL); Previous: C.3 Oracle AQ, the Advanced Queueing Facility Oracle PL/SQL Programming, 2nd Edition Next: C.5 DBMS_ JOB Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. C.3 Oracle AQ, the Advanced Queueing Facility Book Index C.5 DBMS_ JOB The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates. All rights reserved. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Previous: C.4 DBMS_DDL Appendix C Built-In Packages Next: C.6 DBMS_LOB (PL/SQL8 Only) C.5 DBMS_ JOB The DBMS_ JOB package provides a way for you to schedule jobs from within the Oracle RDBMS. A job is a call to a single stored procedure. You can submit a job to run once or on a recurring basis. Once a job has been submitted, you can check on the status of the job by viewing a data dictionary table. You can also change the parameters of the job with the CHANGE procedure. When you submit a job, you must provide a string that describes that job to the DBMS_ JOB package and specify a job execution interval. C.5.1 The BROKEN procedure The Oracle Server considers a job to be broken if it has tried and failed 16 times to run the job. At this point, Oracle marks the job as broken and will no longer try to run the job until either (a) you mark the job as fixed or (b) you force the job to execute with a call to the RUN procedure. Use the BROKEN procedure to mark the job as fixed and specify the next date on which you want the job to run. The specification is: PROCEDURE DBMS_JOB.BROKEN (job IN BINARY_INTEGER, broken IN BOOLEAN, next_date IN DATE DEFAULT SYSDATE); C.5.2 The CHANGE procedure Use the CHANGE procedure to change one or all of the attributes of a job. The specification is: PROCEDURE DBMS_JOB.CHANGE (job IN BINARY_INTEGER, what IN VARCHAR2, next_date IN DATE, interval IN VARCHAR2); C.5.3 The INTERVAL procedure Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Use the INTERVAL procedure to change the interval for which a queued job is going to run. The specification is: PROCEDURE DBMS_JOB.INTERVAL (job IN BINARY_INTEGER, interval IN VARCHAR2); C.5.4 The ISUBMIT procedure The ISUBMIT procedure submits a new job with a specified job number to the queue. The difference between ISUBMIT and SUBMIT (described later in this section) is that ISUBMIT specifies a job number, whereas SUBMIT returns a job number generated by the DBMS_JOB package. The specification is: PROCEDURE DBMS_JOB.ISUBMIT (job IN BINARY_INTEGER, what IN VARCHAR2, next_date in DATE DEFAULT SYSDATE interval IN VARCHAR2 DEFAULT 'NULL', no_parse in BOOLEAN DEFAULT FALSE); C.5.5 The NEXT_DATE procedure Use the NEXT_DATE procedure to change when a queued job is going to run. The specification is: PROCEDURE DBMS_JOB.NEXT_DATE (job IN BINARY_INTEGER, next_date IN DATE); C.5.6 The REMOVE procedure Use the REMOVE procedure to remove a job from the queue. If the job has started execution, you cannot remove it from the queue. The specification is: PROCEDURE DBMS_JOB.REMOVE (job IN BINARY_INTEGER); C.5.7 The RUN procedure Use the RUN procedure to force a job to be executed immediately, regardless of the values for next_date and interval stored in the job queue. The specification is: PROCEDURE DBMS_JOB.RUN (job IN BINARY_INTEGER); Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... C.8 DBMS_MAIL The DBMS_MAIL package provides an interface to Oracle Office (formerly Oracle* Mail) To use this package you must first install the Oracle Office product C.8.1 The SEND procedure The SEND procedure provides a programmatic interface to the Oracle* Mail send-message facility Use the SEND module to send an Oracle* Mail message The specification is: PROCEDURE DBMS_MAIL.SEND (from_str IN VARCHAR2,... Only) Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.8 DBMS_MAIL C.8 DBMS_MAIL The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark Appendix C Built-In Packages Previous: C.7 DBMS_LOCK Next: C.9 DBMS_OUTPUT C.8 DBMS_MAIL The DBMS_MAIL package provides an interface to Oracle. .. Only) Use the DBMS_ROWID package to work with ROWIDs from within PL/SQL programs and SQL statements Remember that as of Oracle8 , there are two types of ROWIDs: extended and restricted Restricted ROWIDs are the ROWIDs available with Oracle Version 7 and earlier Extended ROWIDs are used in Oracle8 C.11.1 The ROWID_CREATE function Call the create function to create a ROWID (either restricted or extended as... job is going to run The specification is: PROCEDURE DBMS_JOB.WHAT (job IN BINARY_INTEGER, what IN VARCHAR2); Previous: C.4 DBMS_DDL C.4 DBMS_DDL Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.6 DBMS_LOB (PL/SQL8 Only) C.6 DBMS_LOB (PL/SQL8 Only) The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to remove... CHARACTER SET ANY_CS, amount IN OUT BINARY_INTEGER, offset IN INTEGER, buffer IN VARCHAR2 CHARACTER SET LOB_LOC%CHARSET); Previous: C.5 DBMS_ JOB C.5 DBMS_ JOB Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.7 DBMS_LOCK C.7 DBMS_LOCK The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark... VARCHAR2, to_str IN VARCHAR2, cc IN VARCHAR2, bcc IN VARCHAR2, subject IN VARCHAR2, reply_to IN VARCHAR2, body IN VARCHAR2); Previous: C.7 DBMS_LOCK C.7 DBMS_LOCK Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.9 DBMS_OUTPUT C.9 DBMS_OUTPUT The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark... PROCEDURE DBMS_OUTPUT.PUT_LINE (A NUMBER); PROCEDURE DBMS_OUTPUT.PUT_LINE (A DATE); Previous: C.8 DBMS_MAIL C.8 DBMS_MAIL Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.10 DBMS_PIPE C.10 DBMS_PIPE Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge... PROCEDURE DBMS_PIPE.UNPACK_MESSAGE (item OUT NUMBER); PROCEDURE DBMS_PIPE.UNPACK_MESSAGE (item OUT DATE); Previous: C.9 DBMS_OUTPUT C.9 DBMS_OUTPUT Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.11 DBMS_ROWID (PL/SQL8 Only) C.11 DBMS_ROWID (PL/ SQL8 Only) The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to... The DBMS_LOCK package provides you with access to the Oracle Lock Management (OLM) services With OLM, you can request a lock of a particular type, assign it a name that can then be used as a handle to this lock, modify the lock, and even release the lock A lock you create with the DBMS_LOCK package has all the functionality of a lock generated by the Oracle RDBMS, including deadlock detection and view... (rowid_in IN ROWID, schema_name IN VARCHAR2, object_name IN VARCHAR2, conversion_type IN INTEGER) RETURN NUMBER; Previous: C.10 DBMS_PIPE C.10 DBMS_PIPE Oracle PL/SQL Programming, 2nd Edition Book Index Next: C.12 DBMS_SESSION C.12 DBMS_SESSION The Oracle Library Navigation Copyright (c) 2000 O'Reilly & Associates All rights reserved Please purchase PDF Split-Merge on www.verypdf.com to remove this . Packages Next: C.4 DBMS_DDL C.3 Oracle AQ, the Advanced Queueing Facility Oracle8 offers the Oracle Advanced Queuing facility (Oracle AQ) which implements. contents, see Oracle Built-in Packages. C.3.1 DBMS_AQ (PL/SQL 8 Only) The DBMS_AQ package provides an interface to the messaging tasks of Oracle AQ. To

Ngày đăng: 28/10/2013, 16:15