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

Oracle Built−in Packages- P149 pdf

5 72 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 79,38 KB

Nội dung

16.3.3.1.2 Restrictions Note the following restrictions on calling ADD_PRIORITY_ <datatype>: • The new value must be unique within the priority group. • The new priority must be unique within the priority group. • ADD_PRIORITY_<datatype> must be called from the master definition site. 16.3.3.1.3 Example To associate priorities with each of the five possible values of PRODUCTION_STATUS, we must make five calls to ADD_PRIORITY_VARCHAR2. After making these calls and a call to DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT, the column group is completely configured. BEGIN DBMS_REPCAT.ADD_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', value => 'CONCEPT', priority => 10); DBMS_REPCAT.ADD_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', value => 'DEVELOPMENT', priority=> 20); DBMS_REPCAT.ADD_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', value => 'BETA', priority=> 30); DBMS_REPCAT.ADD_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', value => 'PRODUCTION', priority=> 40); DBMS_REPCAT.ADD_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', value => 'DISCONTINUED', priority=> 50); END; TIP: It is a good idea to number priorities in multiples of 10 or more so that you can easily add new priority values later as requirements change. 16.3.3.2 The DBMS_REPCAT.ALTER_PRIORITY procedure The ALTER_PRIORITY procedure lets you change the priority associated with a specific value in a priority group. The specifications differ for Oracle7 and Oracle8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_PRIORITY (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, old_priority IN NUMBER, new_priority IN NUMBER, sname IN VARCHAR2 := ''); Here is the Oracle8 specification: [Appendix A] What's on the Companion Disk? 16.3.3 Creating and Maintaining Priorities Within a Priority Group 731 PROCEDURE DBMS_REPCAT.ALTER_PRIORITY (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, old_priority IN NUMBER, new_priority IN NUMBER) Parameters are summarized in the following table. Name Description gname Name of the replication group to which priority group pgroup belongs pgroup Name of the priority group whose priority is being altered old_priority pgroup's previous priority value new_priority pgroup's new priority value sname Not used 16.3.3.2.1 Exceptions The ALTER_PRIORITY procedure may raise the following exceptions: Name Number Description duplicatepriority −23335 Priority new_priority already exists in priority group pgroup missingprioritygroup −23336 Priority group pgroup does not exist missingvalue −23337 Value was not registered (with a call to ADD_PRIORITY_<datatype> nonmasterdef −23312 Calling site is not the master definition site 16.3.3.2.2 Restrictions Note the following restrictions on calling ALTER_PRIORITY: • You must call the ALTER_PRIORITY procedure from the master definition site. • The new priority must be unique within the priority group. 16.3.3.2.3 Examples Suppose that our requirements change such that we want the PRODUCTION_STATUS value DEVELOPMENT to have higher priority than BETA. We can accomplish this by changing the priority associated with DEVELOPMENT from 30 to 45. BEGIN DBMS_REPCAT.ALTER_PRIORITY( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', old_priority => 30, new_priority => 45); END; As with the call to ADD_PRIORITY_<datatype>, this change takes effect after the next call to DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT. [Appendix A] What's on the Companion Disk? 16.3.3 Creating and Maintaining Priorities Within a Priority Group 732 16.3.3.3 The DBMS_REPCAT.ALTER_PRIORITY_<datatype> procedure The ALTER_PRIORITY_<datatype> procedures let you alter the data value associated with a specific priority for a priority group. The specifications differ for Oracle7 and Oracle8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_PRIORITY_<datatype> (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, old_value IN {CHAR|VARCHAR2|NUMBER|DATE|RAW}, new_value IN {CHAR|VARCHAR2|NUMBER|DATE|RAW}, sname IN VARCHAR2 := ''); Here is the Oracle8 specification: PROCEDURE DBMS_REPCAT.ALTER_PRIORITY_<datatype> (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, old_value IN {CHAR|NCHAR|VARCHAR2|NUMBER|DATE|RAW}, new_value IN {CHAR|NCHAR|VARCHAR2|NUMBER|DATE|RAW}); <datatype> can be one of the following, and value and old_value can be any of these types: CHAR VARCHAR2 NUMBER DATE RAW NCHAR (Oracle8 only) NVARCHAR2 (Oracle8 only) Parameters are summarized in the following table. Name Description gname Name of the replication group to which priority group pgroup belongs pgroup Name of the priority group whose priority is being altered old_value Current value of the priority group member new_value New value of the priority group member sname (Oracle7 only) Not used 16.3.3.3.1 Exceptions The ALTER_PRIORITY_<datatype> procedure may raise the following exceptions: Name Number Description duplicatevalue −23338 Value new_value is already designated a priority in priority group pgroup missingprioritygroup −23336 Priority group pgroup does not exist missingvalue −23337 Value was not registered (with a call to ADD_PRIORITY_<datatype> nonmasterdef −23312 Calling site is not the master definition site [Appendix A] What's on the Companion Disk? 16.3.3 Creating and Maintaining Priorities Within a Priority Group 733 16.3.3.3.2 Restrictions Note the following restrictions on calling ALTER_PRIORITY_<datatype>: • You must call the ALTER_PRIORITY_<datatype> procedure from the master definition site. • The new priority must be unique within the priority group. 16.3.3.3.3 Example Suppose that we want to change the data value associated with priority 50 from DISCONTINUED to OBSOLETE. We would make the following call: BEGIN DBMS_REPCAT.ALTER_PRIORITY_VARCHAR2( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', old_value => 'DISCONTINUED', new_value => 'OBSOLETE'); END; This call would take effect after the next call to GENERATE_REPLICATION_SUPPORT for an object in the SPROCKET replication group. 16.3.4 Dropping Priorities from a Priority Group The DROP_PRIORITY and DROP_PRIORITY_<datatype> remove values from a priority group. You can specify the value to be removed by priority (with DROP_PRIORITY) or by data value (with DROP_PRIORITY_<datatype>). 16.3.4.1 The DBMS_REPCAT.DROP_PRIORITY procedure The DROP_PRIORITY procedure removes a value from a priority group. In this version of the procedure, you must specify the value by priority. The specifications differ for Oracle7 and Oracle 8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.DROP_PRIORITY (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, priority_num IN NUMBER, sname IN VARCHAR2 := ''); Here is the Oracle8 specification: PROCEDURE DBMS_REPCAT.DROP_PRIORITY (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, priority_num IN NUMBER); Parameters are summarized in the following table. Name Description gname Name of the replication group to which priority group pgroup belongs [Appendix A] What's on the Companion Disk? 16.3.3 Creating and Maintaining Priorities Within a Priority Group 734 pgroup Name of the priority group whose priority is being altered priority_num Priority for the value to be dropped sname Not used 16.3.4.1.1 Exceptions The DROP_PRIORITY procedure may raise the following exceptions: Name Number Description missingprioritygroup −23336 Priority group pgroup does not exist. missingrepgroup −23373 Replication group gname does not exist. nonmasterdef −23312 Calling site is not the master definition site. 16.3.4.1.2 Restrictions You must call the DROP_PRIORITY procedure from the master definition site. 16.3.4.1.3 Example In the following example, we drop the member of the PG_PRODUCTION_STATUS priority group whose priority is 50: BEGIN DBMS_REPCAT.DROP_PRIORITY( gname => 'SPROCKET', pgroup => 'PG_PRODUCTION_STATUS', priority => 50); END; This change takes effect the next time we run DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT for an object in the SPROCKET replication group. 16.3.4.2 The DBMS_REPCAT.DROP_PRIORITY_<datatype> procedure The DROP_PRIORITY_<datatype> procedure removes a value from a priority group. In this version of the procedure, you can specify the value by data value. The specifications differ for Oracle7 and Oracle 8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.DROP_PRIORITY_<datatype> (gname IN VARCHAR2 := '', pgroup IN VARCHAR2, value IN {CHAR|VARCHAR2|NUMBER|DATE|RAW}, sname IN VARCHAR2 := ''); Here is the Oracle8 specification: PROCEDURE DBMS_REPCAT.DROP_PRIORITY_<datatype> (name IN VARCHAR2 := '', pgroup IN VARCHAR2, value IN {CHAR|NCHAR|VARCHAR2|NUMBER|DATE|RAW}, sname IN VARCHAR2 := ''); <datatype> can be any of the following, and value can be any of these types: CHAR [Appendix A] What's on the Companion Disk? 16.3.4 Dropping Priorities from a Priority Group 735 . with a specific value in a priority group. The specifications differ for Oracle7 and Oracle8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_PRIORITY (gname IN VARCHAR2. with a specific priority for a priority group. The specifications differ for Oracle7 and Oracle8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_PRIORITY_<datatype> . procedure, you must specify the value by priority. The specifications differ for Oracle7 and Oracle 8 as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.DROP_PRIORITY (gname IN VARCHAR2

Ngày đăng: 07/07/2014, 00:20

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN