DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_EXPORT_EXTENSION

Source


1 PACKAGE DBMS_EXPORT_EXTENSION AUTHID CURRENT_USER AS
2 ------------------------------------------------------------
3 -- Overview
4 --
5 -- This package implements PL/SQL extensions to Export.
6 -- ...
7 ---------------------------------------------------------------------
8 -- SECURITY
9 -- This package is owned by SYS, invoker's rights, and is granted to PUBLIC.
10 -- The procedures dynamically called by the package are called using
11 -- dbms_sql.parse.  Privileged operations are done in a definer's rights
12 -- package, DBMS_EXPORT_EXTENSION_I (prvthpexpi.sql, prvtbpexpi.sql).
13 ------------------------------------------------------------------------------
14 -- EXCEPTIONS
15 --
16    unExecutedActions EXCEPTION;
17 -- A function was not called with the same parameters until it returned NULL.
18 -- This indicates an internal error in EXPORT.
19 -- CONSTANTS
20 --
21 --   Function codes for the expact$ table.
22 --
23   func_pre_table   CONSTANT NUMBER := 1;     /* execute before loading table */
24   func_post_tables CONSTANT NUMBER := 2; /* execute after loading all tables */
25   func_pre_row     CONSTANT NUMBER := 3;       /* execute before loading row */
26   func_post_row    CONSTANT NUMBER := 4;        /* execute after loading row */
27   func_row         CONSTANT NUMBER := 5;   /* execute in lieu of loading row */
28 ------------------------------------------------------------------------------
29 -- PROCEDURES AND FUNCTIONS
30   FUNCTION pre_table(obj_schema IN VARCHAR2,
31                      obj_name   IN VARCHAR2)
32     RETURN VARCHAR2;
33 -- execute pre_table functions from the expact$ table, for a specific object
34 -- Input Parameters:
35 --   obj_schema
36 --     The schema of the object being exported.
37 --   obj_name
38 --     The name for the object being exported.
39 -- Result:
40 --   A string containg a procedure invocation to be put in the export stream.
41 --   If non-null, this procedure should be called again (immediately) for the
42 --   same object.  If NULL, there are no additional pre_table calls to
43 --   be exported to the stream for this object and function.
44 -- Exceptions:
45 --   unExecutedActions
46 --   Any error encountered during executing of the action
47 
48   FUNCTION post_tables(obj_schema IN VARCHAR2,
49                        obj_name   IN VARCHAR2)
50     RETURN VARCHAR2;
51 -- execute post_tables functions from the expact$ table, for a specific object
52 -- Input Parameters:
53 --   obj_schema
54 --     The schema of the object being exported.
55 --   obj_name
56 --     The name for the object being exported.
57 -- Result:
58 --   A string containing a procedure invocation to be put in the export stream.
59 --   If non-null, this procedure should be called again (immediately) for the
60 --   same object.
61 --  If NULL, there are no additional post_tables calls to be exported to the
62 --   stream for this object.
63 -- Exceptions:
64 --   unExecutedActions
65 --   Any error encountered during executing of the action
66 ----------------------------------------------------------------------------
67 -- ROW FUNCTIONS WILL BE ADDED IN THE FUTURE
68 ----------------------------------------------------------------------------
69 
70   FUNCTION get_domain_index_metadata (
71         index_name      IN  VARCHAR2,
72         index_schema    IN  VARCHAR2,
73         type_name       IN  VARCHAR2,
74         type_schema     IN  VARCHAR2,
75         version         IN  VARCHAR2,
76         newblock        OUT PLS_INTEGER,
77         gmflags         IN  NUMBER DEFAULT -1,         -- Post-v1 DI only
78         datapump_debug  IN  NUMBER DEFAULT -1 )
79         RETURN VARCHAR2;
80 
81 -- Acts as intermediary between export and the ODCIIndexGetMetadata method on
82 -- a domain index's implementation type. This allows the index to return
83 -- PL/SQL-based "metadata" such as policy info. Strings are returned
84 -- representing pieces of PL/SQL blocks to execute at import time. Multiple
85 -- PL/SQL blocks can be built
86 --
87 -- PARAMETERS:
88 --   index_name, index_schema   - Identifies current index
89 --   type_name, type_schema     - Identifies index's implementation type
90 --   exp_version  - Export's version; e.g, '08.01.03.00.00'
91 --   newblock - Allows callee to write multiple blocks of PL/SQL code.
92 --      non-zero: Return string starts a new block,
93 --      zero: Return string continues current block.
94 --   gmflags  - Only for post-V1 getindexmetadata call.  The default
95 --              value is -1 due to a bug in the use of NULL for NUMBER
96 --              datatypes.
97 --              See catodci.sql for description of the flags
98 --   datapump_debug - if > 0 the caller is Data Pump; write trace
99 --              information from exceptions
100 -- RETURNS:
101 -- A piece of a PL/SQL block to be executed at import time. The BEGIN/END;
102 -- surrounding each block should not be returned as export will add these.
103 -- This routine will be repeatedly called until an empty string is returned.
104 --
105   FUNCTION get_object_source (
106            objid     IN  NUMBER,
107            objtype   IN  NUMBER)
108            RETURN VARCHAR2;
109 
110 -- This function is used to get the source string for CREATE OPERATOR and
111 -- CREATE INDEXTYPE. The function is passed the object number and the
112 -- object type and the string returned is the SQL statement needed to
113 -- create the operator or the index type.
114 -- PARAMTERS:
115 --   objid   - object number of the operator or indextype
116 --   objtype - object type (32 for indextype, 33 for operators)
117 -- RETURNS:
118 -- The SQL string that can be used to create the operator or the indextype
119 -- specified by the object id
120 
121 
122 -- get_domain_index_tables
123 -- for post V1 domain index implementations, see the _v2_ version below
124 --------------------------
125 
126   FUNCTION get_domain_index_tables (
127         index_name      IN  VARCHAR2,
128         index_schema    IN  VARCHAR2,
129         type_name       IN  VARCHAR2,
130         type_schema     IN  VARCHAR2,
131         read_only       IN  PLS_INTEGER,
132         version         IN  VARCHAR2,
133         get_tables      IN  PLS_INTEGER)
134         RETURN VARCHAR2;
135 
136 -- Acts as intermediary between export and the ODCIIndexUtilGetTableNames
137 -- method on a domain index's implementation type. This allows the index to
138 -- return list of secondary tablenames (seperated by comma) which are to be
139 -- exported and imported to speed up rebuild of domain indexes during import.
140 -- PARAMETERS:
141 --   index_name, index_schema   - Identifies current index
142 --   type_name, type_schema     - Identifies index's implementation type
143 --   version    - Export's version; e.g, '08.01.03.00.00'
144 --   read_only  - Is this a read-only transaction ?  True for Export if
145 --                CONSISTENT=y.  Note: some types may not be able to exploit
146 --                fast rebuild in a read-only environment.
147 --                1 => read_only.
148 --   get_tables - Export will first call this function with get_tables=1.
149 --   In this case, the function will instantiate both an instance of the
150 --   implementation type as defined by  type_name and type_schema, and an
151 --   object of type ODCIIndexInfo using parameters index_name and index_schema.
152 --   It will then call ODCIIndexUtilGetTableNames method on the implementation
153 --   type using the ODCIIndexInfo object just constructed. The routine will
154 --   also maintain in a PL/SQL variable of session scope the context returned
155 --   from ODCIIndexUtilGetTableNames to be handed back upon its second call.
156 --
157 --   After export writes all the tables returned on the first call to its
158 --   dump file, it will call get_domain_index_tables again with parameter
159 --   get_tables=0. In this case, this function will then call the
160 --   ODCIIndexCleanup method on the ODCIIndexInfo object constructed in the
161 --   first call handing in the internally stored context. When this returns,
162 --   it will clean up its state and return a NULL string to export.
163 
164 
165 -- get_v2_domain_index_tables
166 -- v1 domain index implementations use the above routine.
167 --------------------------
168 
169   FUNCTION get_v2_domain_index_tables (
170         index_name      IN  VARCHAR2,
171         index_schema    IN  VARCHAR2,
172         type_name       IN  VARCHAR2,
173         type_schema     IN  VARCHAR2,
174         read_only       IN  PLS_INTEGER,
175         version         IN  VARCHAR2,
176         get_tables      IN  PLS_INTEGER,
177         gmflags         IN  NUMBER)
178         RETURN INTEGER;
179 
180 -- Acts as intermediary between export and the ODCIIndexUtilGetTableNames
181 -- method on a domain index's implementation type.
182 -- Unlike the initial (v1) impelementation, the _v2_ 0/1
183 -- value which export will use to determine if all the secondary objects
184 -- associated with a domain index should be exported (1) or not (0)
185 --
186 -- PARAMETERS:
187 --   index_name, index_schema   - Identifies current index
188 --   type_name, type_schema     - Identifies index's implementation type
189 --   version    - Export's version; e.g, '08.01.03.00.00'
190 --   read_only  - Is this a read-only transaction ?  True for Export if
191 --                CONSISTENT=y.  Note: some types may not be able to exploit
192 --                fast rebuild in a read-only environment.
193 --                1 => read_only.
194 --   get_tables - Ignored.
195 --   gmflags   - Flags for domain index.  May have TransTblspc set if
196 --               in transportable mode.
197 
198 -- begin_import_domain_index
199 --------------------------
200 
201   PROCEDURE begin_import_domain_index (
202         idxschema      IN  VARCHAR2,
203         idxname        IN  VARCHAR2);
204 
205 -- truncates the table odci_secobj$, and set up index schema and name
206 -- PARAMETERS:
207 --   idxschema, idxname   - Identifies current index
208 
209 -- insert_secobj
210 --------------------------
211 
212   PROCEDURE insert_secobj (
213         secobjschema     IN  VARCHAR2,
214         secobjname       IN  VARCHAR2);
215 
216 -- insert an entry into the table odci_secobj$,
217 -- PARAMETERS:
218 --   secobjschema, secobjname   - Identifies current secondary table
219 
220 --
221 -- Checks to see if a partition has made use of a template partition clause
222 --
223   FUNCTION check_match_template (
224         pobjno          IN  INTEGER
225       ) RETURN INTEGER;
226 
227 -- get_object_comment
228 ---------------------------
229 
230   FUNCTION get_object_comment (
231         objid IN NUMBER,
232         objtype IN NUMBER)
233         RETURN VARCHAR2;
234 -- This function is used to get the source string for COMMENT OPERATOR and
235 -- COMMENT INDEXTYPE. The function is passed the object number, and the type
236 -- of object (indextype or operator).  The string returned is the SQL
237 -- statement needed to comment the operator or the indextype.  If there is no
238 -- comment registered for this operator or indextype, the return string is
239 -- empty.
240 -- PARAMETERS:
241 --   objid   - object number of the operator or indextype
242 --   objtype - object type (32 for indextype, 33 for operators)
243 -- RETURNS:
244 -- The SQL string that can be used to comment the operator or the indextype
245 -- specified by the object id.  If there is no comment registered, the string
246 -- is empty.
247 
248   PROCEDURE set_imp_events;
249   PROCEDURE set_hakan_event;
250   PROCEDURE set_secondaryobj_event;
251   PROCEDURE reset_secondaryobj_event;
252   PROCEDURE set_iot_event;
253   PROCEDURE set_exp_opq_typ_event;
254   PROCEDURE reset_exp_opq_typ_event;
255   PROCEDURE set_no_outlines;
256   PROCEDURE set_nls_numeric_char;
257   PROCEDURE reset_nls_numeric_char;
258   PROCEDURE set_exp_timezone;
259   PROCEDURE set_exp_sortsize;
260   PROCEDURE set_statson;
261   PROCEDURE set_resum;
262   PROCEDURE set_resumnam (
263                 name                    IN VARCHAR2);
264   PROCEDURE set_resumtim (
265                 time                    IN INTEGER);
266   PROCEDURE set_resumnamtim (
267                 name                    IN VARCHAR2,
268                 time                    IN INTEGER);
269   PROCEDURE set_imp_timezone(
270                 timezone                IN VARCHAR2);
271   PROCEDURE set_imp_skip_indexes_on;
272   PROCEDURE set_imp_skip_indexes_off;
273 
274 -- NULLTOCHR0 - Replace \0 with CHR(0) in varchar
275 -- PARAMETERS:
276 --      value           - varchar value
277 -- RETURNS: varchar value with substitutions made
278 
279 FUNCTION nulltochr0(value IN  VARCHAR2)
280         RETURN VARCHAR2 ;
286 --      colname          - varchar2 value
281 
282 -- FUNC_INDEX_DEFAULT  - get default$ from col$ for a func index
283 --                       and convert it to varchar2 from long
284 -- PARAMETERS:
285 --      tabobj           - binary_integer value
287 -- RETURNS: clob value converted from long
288 -- ERROR: if value > 32000 bytes, then pl/sql will raise error ORA-6502
289 -- The error should be fine as the default$ contains the expression for
290 -- a functional index which is unlikely to exceed 32000 bytes
291 
292 FUNCTION func_index_default
293     (tabobj  IN  NUMBER,
294      colname IN  VARCHAR2) RETURN CLOB;
295 
296 END DBMS_EXPORT_EXTENSION;