DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_METADATA_DIFF

Source


1 PACKAGE dbms_metadata_diff AUTHID CURRENT_USER AS
2 ---------------------------------------------------------------------
3 -- Overview
4 -- This pkg implements the comparison interface of the Data Pump Metadata API.
5 --
6 --      USE OF THIS PACKAGE REQUIRES A LICENSE TO THE ORACLE ENTERPRISE
7 --      MANAGER CHANGE MANAGEMENT OPTION.
8 ---------------------------------------------------------------------
9 -- SECURITY
10 -- This package is owned by SYS with execute access granted to PUBLIC.
11 -- It runs with invokers rights, i.e., with the security profile of
12 -- the caller.  It calls DBMS_METADATA_INT to perform privileged
13 -- functions.
14 
15 ---------------------------
16 -- PROCEDURES AND FUNCTIONS
17 --
18 -- OPENC:
19 --        This function establishes a 'compare' context and specifies the
20 --        object type for comparing to (S)XML documents.
21 -- PARAMETERS:
22 --      object_type  - Identifies the type of objects to be compared; i.e.,
23 --              TABLE, INDEX, etc.
24 -- RETURNS:
25 --      A handle to be used in subsequent calls to ADD_DOCUMENT,
26 --      COMPARE_SXML, etc
27 -- EXCEPTIONS:
28 --      INVALID_ARGVAL  - a NULL or invalid value was supplied for an input
29 --              parameter.
30 
31   FUNCTION openc (
32                 object_type     IN  VARCHAR2)
33         RETURN NUMBER;
34 
35 -- ADD_DOCUMENT : Specifies an (S)XML document (as XMLTYPE) to be compared.
36 -- PARAMETERS:
37 --      handle          - Context handle from previous OPENC call.
38 --      document        - document (xmltype) to be compared
39 -- EXCEPTIONS:
40 --      INVALID_ARGVAL  - a NULL or invalid value was supplied for an input
41 --              parameter.
42 
43   PROCEDURE add_document (
44                handle          IN  NUMBER,
45                document        IN  sys.XMLType);
46 
47 -- ADD_DOCUMENT : Specifies an (S)XML document (as clob) to be compared.
48 -- PARAMETERS:
49 --      handle          - Context handle from previous OPENC call.
50 --      document        - document (clob) to be compared
51 -- EXCEPTIONS:
52 --      INVALID_ARGVAL  - a NULL or invalid value was supplied for an input
53 --              parameter.
54 
55   PROCEDURE add_document (
56                 handle          IN  NUMBER,
57                 document        IN  CLOB);
58 
59 -- PROCEDURE FETCH_CLOB: Return SXML diff document.
60 -- PARAMETERS:  handle - (IN) Context handle from previous OPENC call.
61 --              xmldoc - (IN OUT) previously allocated CLOB to hold the
62 --                       returned diff document.
63 --              diffs  - (OUT) flag (1 == diffs found; 0==no diffs found)
64 
65   FUNCTION fetch_clob (
66                 handle  IN NUMBER)
67          RETURN CLOB;
68 
69   PROCEDURE fetch_clob (
70                 handle  IN NUMBER,
71                 xmldoc  IN OUT NOCOPY CLOB);
72 
73   PROCEDURE fetch_clob (
74                 handle  IN NUMBER,
75                 xmldoc  IN OUT NOCOPY CLOB,
76                 diffs   OUT BOOLEAN);
77 
78 -- CLOSE:       Cleanup all context associated with handle.
79 -- PARAMETERS:  handle  - Context handle from previous OPENC call.
80 
81   PROCEDURE CLOSE (handle IN NUMBER);
82 
83 -- COMPARE_SXML:
84 --        The functions compares the metadata for two objects and returns
85 --        an sxml difference document.
86 -- RETURNS:
87 --        CLOB containing sxml difference document.
88 -- PARAMETERS:
89 --        object_type   - type of object to be retrieved and compared
90 --        name1         - first object to be compared
91 --        name2         - second object to be compared
92 --        schema1       - schema of the first obj to be compared
93 --        schema2       - schema of the second obj to be compared
94 --        network_link1 - name of a database link where the first obj
95 --                        resides.
96 --        network_link2 - name of a database link where the second obj
97 --                        resides.
98 -- EXCEPTIONS:  Throws an exception if COMPARE failed.
99 
100   FUNCTION compare_sxml (
101                 object_type     IN VARCHAR2,
102                 name1           IN VARCHAR2,
103                 name2           IN VARCHAR2,
104                 schema1         IN VARCHAR2 DEFAULT NULL,
105                 schema2         IN VARCHAR2 DEFAULT NULL,
106                 network_link1   IN VARCHAR2 DEFAULT NULL,
107                 network_link2   IN VARCHAR2 DEFAULT NULL)
108         RETURN CLOB;
109 
110 -- COMPARE_ALTER:
111 --        This function compares the metadata for two objects and returns a
112 --        set of ALTER statements for making object 1 like object2.
113 -- RETURNS:
114 --        CLOB containing alter statements for making object 1 like object 2
115 -- PARAMETERS:
116 --        object_type   - type of object to be retrieved and compared
117 --        name1         - first object to be compared
118 --        name2         - second object to be compared
119 --        schema1       - schema of the first obj to be compared
120 --        schema2       - schema of the second obj to be compared
121 --        network_link1 - name of a database link where the first obj
122 --                        resides.
123 --        network_link2 - name of a database link where the second obj
124 --                        resides.
125 -- EXCEPTIONS:  Throws an exception if COMPARE failed.
126 
127   FUNCTION compare_alter (
128                 object_type     IN VARCHAR2,
129                 name1           IN VARCHAR2,
130                 name2           IN VARCHAR2,
131                 schema1         IN VARCHAR2 DEFAULT NULL,
132                 schema2         IN VARCHAR2 DEFAULT NULL,
133                 network_link1   IN VARCHAR2 DEFAULT NULL,
134                 network_link2   IN VARCHAR2 DEFAULT NULL)
135         RETURN CLOB;
136 
137 -- COMPARE_ALTER_XML:
138 --        This function compares the metadata for two objects and returns
139 --        an ALTER_XML document.
140 -- RETURNS:
141 --        CLOB containing sxml difference document.
142 -- PARAMETERS:
143 --        object_type   - type of object to be retrieved and compared
144 --        name1         - first object to be compared
145 --        name2         - second object to be compared
146 --        schema1       - schema of the first obj to be compared
147 --        schema2       - schema of the second obj to be compared
148 --        network_link1 - name of a database link where the first obj
149 --                        resides.
150 --        network_link2 - name of a database link where the second obj
151 --                        resides.
152 -- EXCEPTIONS:  Throws an exception if COMPARE failed.
153 
154   FUNCTION compare_alter_xml (
155                 object_type     IN VARCHAR2,
156                 name1           IN VARCHAR2,
157                 name2           IN VARCHAR2,
158                 schema1         IN VARCHAR2 DEFAULT NULL,
159                 schema2         IN VARCHAR2 DEFAULT NULL,
160                 network_link1   IN VARCHAR2 DEFAULT NULL,
161                 network_link2   IN VARCHAR2 DEFAULT NULL)
162         RETURN CLOB;
163 END DBMS_METADATA_DIFF;