DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_REPCAT_RGT

Source


1 package       "DBMS_REPCAT_RGT" AUTHID CURRENT_USER as
2   ----------------------------------------
3   -- Types
4   --
5   type octtype is table of number index by binary_integer;
6 
7 
8   ----------------------------------------
9   -- Exceptions
10   --
11 
12   miss_user_authorization exception;
13   pragma exception_init(miss_user_authorization, -23436);
14   miss_user_authorization_num NUMBER := -23436;
15 
16   dupl_user_authorization exception;
17   pragma exception_init(dupl_user_authorization, -23437);
18   dupl_user_authorization_num NUMBER := -23437;
19 
20   miss_refresh_template exception;
21   pragma exception_init(miss_refresh_template, -23438);
22   miss_refresh_template_num NUMBER := -23438;
23 
24   dupl_refresh_template exception;
25   pragma exception_init(dupl_refresh_template, -23439);
26   dupl_refresh_template_num NUMBER := -23439;
27 
28   bad_public_template exception;
29   pragma exception_init(bad_public_template, -23440);
30   bad_public_template_num NUMBER := -23440;
31 
32   miss_template_object exception;
33   pragma exception_init(miss_template_object, -23441);
34   miss_template_object_num NUMBER := -23441;
35 
36   dupl_template_object exception;
37   pragma exception_init(dupl_template_object, -23442);
38   dupl_template_object_num NUMBER := -23442;
39 
40   bad_object_type exception;
41   pragma exception_init(bad_object_type, -23319);
42   bad_object_type_num NUMBER := -23319;
43 
44   miss_template_parm exception;
45   pragma exception_init(miss_template_parm, -23443);
46   miss_template_parm_num NUMBER := -23443;
47 
48   dupl_template_parm exception;
49   pragma exception_init(dupl_template_parm, -23444);
50   dupl_template_parm_num NUMBER := -23444;
51 
52   miss_template_site exception;
53   pragma exception_init(miss_template_site, -23445);
54   miss_template_site_num NUMBER := -23445;
55 
56   dupl_template_site exception;
57   pragma exception_init(dupl_template_site, -23446);
58   dupl_template_site_num NUMBER := -23446;
59 
60   bad_status exception;
61   pragma exception_init(bad_status, -23470);
62   bad_status_num NUMBER := -23470;
63 
64   miss_user_parm_value exception;
65   pragma exception_init(miss_user_parm_value, -23447);
66   miss_user_parm_value_num NUMBER := -23447;
67 
68   dupl_user_parm_value exception;
69   pragma exception_init(dupl_user_parm_value, -23448);
70   dupl_user_parm_value_num NUMBER := -23448;
71 
72   miss_user exception;
73   pragma exception_init(miss_user, -23449);
74   miss_user_num NUMBER := -23449;
75 
76   miss_object exception;
77   pragma exception_init(miss_object, -23468);
78   miss_object_num NUMBER := -23468;
79 
80   diff_object exception;
81   pragma exception_init(diff_object, -23469);
82   diff_object_num NUMBER := -23469;
83 
84   not_authorized exception;
85   pragma exception_init(not_authorized, -23471);
86   not_authorized_num NUMBER := -23471;
87 
88   bad_ddl exception;
89   pragma exception_init(bad_ddl, -23474);
90   bad_ddl_num NUMBER := 23474;
91 
92   missing_offline_dirpath exception;
93   pragma exception_init(missing_offline_dirpath, -23502);
94   missing_offline_dirpath_num NUMBER := -23502;
95 
96   duplicated_siteowner exception;
97   pragma exception_init(duplicated_siteowner, -23531);
98   duplicated_siteowner_num NUMBER := -23531;
99 
100   not_cacheable_obj exception;
101   pragma exception_init(not_cacheable_obj, -23533);
102   not_cacheable_obj_num NUMBER := -23533;
103 
104   ----------------------------------------
105   -- constants
106   --
107   -- constants used for defining object_types
108   DBLINK_RGT CONSTANT NUMBER   := -5;
109   SNAPSHOT_RGT CONSTANT NUMBER := -1;
110   INDEX_RGT CONSTANT NUMBER :=     1;
111   TABLE_RGT CONSTANT NUMBER :=     2;
112   VIEW_RGT CONSTANT NUMBER :=      4;
113   SYNONYM_RGT CONSTANT NUMBER :=   5;
114   SEQUENCE_RGT CONSTANT NUMBER :=  6;
115   PROCEDURE_RGT CONSTANT NUMBER := 7;
116   FUNCTION_RGT CONSTANT NUMBER :=  8;
117   PACKAGE_RGT CONSTANT NUMBER :=   9;
118   PACKAGE_BODY_RGT CONSTANT NUMBER := 10;
119   TRIGGER_RGT CONSTANT NUMBER := 12;
120 
121   -- constants used for SQL validatation.
122   dblink_oct_rgt CONSTANT NUMBER :=  32;
123   snapshot_oct_rgt CONSTANT NUMBER :=  74;
124   index_oct_rgt CONSTANT NUMBER :=  9;
125   table_oct_rgt CONSTANT NUMBER :=  1;
126   view_oct_rgt CONSTANT NUMBER :=  21;
127   synonym_oct_rgt CONSTANT NUMBER :=  19;
128   sequence_oct_rgt CONSTANT NUMBER :=  13;
129   procedure_oct_rgt  CONSTANT NUMBER :=  24;
130   function_oct_rgt  CONSTANT NUMBER :=  91;
131   package_oct_rgt  CONSTANT NUMBER :=  94;
132   package_body_oct_rgt  CONSTANT NUMBER :=  97;
133   trigger_oct_rgt  CONSTANT NUMBER :=  59;
134 
135   -- constants for template_type flags
136   template_type_rgt_templates CONSTANT NUMBER := 1;
137   template_type_ias_templates CONSTANT NUMBER := 2;
138 
139   -- constants for object_type flags
140   object_type_rgt_templates CONSTANT NUMBER := 1;
141   object_type_ias_templates CONSTANT NUMBER := 2;
142 
143   -- constants for template_sites table
144   INSTALLING_STATUS CONSTANT NUMBER := 0;
145   INSTALLED_STATUS CONSTANT NUMBER := 1;
146 
147   -- constants for communicating with snapshot callout
148   INSERT_LINE CONSTANT NUMBER := 1;
149   REFRESH_LINE CONSTANT NUMBER := 0;
150 
151   -- size of lob chunk to write during offline instantiation
152   LOB_WRITE_SIZE CONSTANT NUMBER := 900;
153 
154   -- For RepAPI offline instantiation
155   -- NOTE: if you make any changes here, you must change the
156   --       corresponding constants in dbmsrint.sql
157   --
158   NO_TRACE_DUMP       CONSTANT NUMBER := 0;
159   RESULTSET_THRESHOLD CONSTANT NUMBER := 32768;
160   LOB_THRESHOLD       CONSTANT NUMBER := 32768;
161 
162   -- ------------------------------------
163   -- package variables
164   --
165 
166   ----------------------------------------
167   -- Public procedures/functions
168   --
169 
170   function create_user_authorization(
171     USER_NAME in VARCHAR2,
172     REFRESH_TEMPLATE_NAME in VARCHAR2) return number;
173 
174   -- This function creates a user authorization granting access to a
175   -- private template.
176   --
177   -- Arguments:
178   --   user_name - database user receiving access to the template
179   --   refresh_template_name - name of the deployment template
180   --
181   -- Return value: the user_authorization_id of the new user_authorization
182   --
183   -- Exceptions:
184   --   dupl_user_authorization - user already authorized for this template
185   --   miss_user - user is not defined in database
186   --   miss_refresh_template - refresh template is not defined
187 
188   function create_refresh_template(
189     OWNER in VARCHAR2,
190     REFRESH_GROUP_NAME in VARCHAR2,
191     REFRESH_TEMPLATE_NAME in VARCHAR2,
192     TEMPLATE_COMMENT in VARCHAR2 := null,
193     PUBLIC_TEMPLATE in VARCHAR2 := null,
194     LAST_MODIFIED in DATE := sysdate,
195     MODIFIED_BY in VARCHAR2 := user,
196     CREATION_DATE in DATE := sysdate,
197     CREATED_BY in VARCHAR2 := user) return number;
198 
199   -- This function creates a deplpyment template.
200   --
201   -- Arguments:
202   --   owner - the database user owning the template
203   --   refresh_group_name - the name of the refresh group to use when
204   --     instantiating the template.
205   --   refresh_template_name - the name of the template.
206   --   template_comment - an optional comment for describing the template
207   --   public_template - public template flag.  Must be 'Y, N or NULL'.  A
208   --     NULL value is interpreted as a 'N'.  A 'Y' value indicates
209   --     this is a public template which can be instantiated by any
210   --     user able to connect to the database.
211   --   last_modified - date the template was last modified defaults to
212   --     sysdate.
213   --   modified_by - database user that last modified the template
214   --     defaults to connected user.
215   --   creation_date - date the template was created.  defaults to
216   --     sysdate.
217   --   created_by - user that created the template.  Defaults to
218   --     connected database user.
219   --
220   -- Return value: returns the refresh_template_id of the newly created
221   --   template.
222   --
223   -- Exceptions:
224   --   dupl_refresh_template - a template with the same name already
225   --     exists.
226   --   miss_user - the specified owner does not exist as a database user.
227 
228   function create_template_object(
229     REFRESH_TEMPLATE_NAME in VARCHAR2,
230     OBJECT_NAME in VARCHAR2,
231     OBJECT_TYPE in VARCHAR2,
232     DDL_TEXT in clob,
233     MASTER_ROLLBACK_SEG in VARCHAR2 := null,
234     FLAVOR_ID in NUMBER := -1e-130) return number;
235 
236   -- This function creates a new object in a deployment template.
237   --
238   -- Arguments:
239   --   refresh_template_name - name of the template to contain the new
240   --     object.
241   --   object_name - name of the object
242   --   object_type - type of object being created.  Must be one of
243   --     'INDEX', 'TABLE','VIEW','SYNONYM','SEQUENCE','PROCEDURE','FUNCTION',
244   --     'PACKAGE','PACKAGE BODY','TRIGGER','SNAPSHOT','DATABASE LINK',
245   --     or 'MATERIALIZED VIEW'.
246   --   ddl_text - ddl text to create the object.
247   --   master_rollback_seg - name of the rollback segment to use for
248   --     snapshots
249   --   flavor_id - id of the flavor for this object.  only required if
250   --     using schema evolution.  defaults to null
251   --
252   -- Return value:
253   --   The returned value is the template_object_id of the newly created
254   --     object.
255   --
256   -- Exceptions:
257   --   miss_refresh_template - the specified template does not exist.
258   --   dupl_template_object - an object of the same type and name already
259   --     exists for this template.
260   --   bad_object_type - object type is invalid.
261   --
262 
263   function create_template_parm(
264     REFRESH_TEMPLATE_NAME in VARCHAR2,
265     PARAMETER_NAME in VARCHAR2,
266     DEFAULT_PARM_VALUE in clob := null,
267     PROMPT_STRING in VARCHAR2 := null,
268     USER_OVERRIDE in VARCHAR2 := null) return number;
269 
270   -- The create_template_parm function is used to create a parameter for
271   -- a template.
272   --
273   -- Arguments:
274   --   refresh_template_name - the template to contain the new parameter
275   --   parameter_name - name of the new parameter
276   --   default_parm_value - the default value for the parameter
277   --   prompt_string - the string to use when prompting for the parameter
278   --     value.
279   --   user_override - a Y/N flag, defaults to 'N'.  If set to 'Y', the
280   --     dba cannot override the default value for this parameter.
281   --
282   -- Return value:
283   --   The create_template_parm function returns the template_parameter_id
284   --   of the new row in the repcat$_template_parameters table.
285   --
286   -- Exceptions:
287   --   miss_refresh_template - the specified template does not exist.
288   --   dupl_template_parm - the parameter already exists for the template
289 
290   function create_user_parm_value(
291     REFRESH_TEMPLATE_NAME IN VARCHAR2,
292     PARAMETER_NAME IN VARCHAR2,
293     USER_NAME IN VARCHAR2,
294     PARM_VALUE in clob := null) return number;
295 
296   -- The create_user_parm_value function creates a value for a parameter for
297   -- a parameter for a user.
298   --
299   -- Arguments:
300   --   refresh_template_name - the template to contain the new parameter value
301   --   parameter_name - the parameter name of creating a new value for.
302   --   user_name - the name of the user creating a new value for
303   --   parm_value - the parameter value
304   --
305   -- Return value:
306   --   The return value is the user_parameter_id of the new row in the
307   --   repcat$_user_parm_values table.
308   --
309   -- Exceptions:
310   --   miss_refresh_template - the specified template does not exist.
311   --   miss_template_parm - the specified template parameter does not exist.
312   --   miss_user - the specified owner does not exist as a database user.
313   --   dupl_user_parm_value - a value already exists for the template,
314   --     parameter, and user.
315 
316   procedure drop_user_authorization(
317     refresh_template_name in varchar2,
318     user_name in varchar2);
319 
320   -- The drop_user_authorization procedure deletes a specified
321   -- user_authorization from the database.
322   --
323   -- Arguments:
324   --   refresh_template_name - the name of the template authorized for
325   --   the user.
326   --   user_name - the database user authorized for the template.
327   --
328   -- Exceptions:
329   --   miss_refresh_template - the specified template does not exist.
330   --   miss_user - the specified owner does not exist as a database user.
331   --   miss_user_authorization - the user_authorization does not exist.
332   --
333 
334   procedure drop_refresh_template(
335     refresh_template_name in varchar2);
336 
337   -- The drop_refresh_template deletes a template and all of its objects,
338   -- parameters, authorizations and user_parm_values from the database
339   --
340   -- Arguments:
341   --   refresh_template_name - the template to be deleted.
342   --
343   -- Exceptions:
344   --   miss_refresh_template - the specified template does not exist.
345 
346   procedure drop_template_object(
347     refresh_template_name in VARCHAR2,
348     object_name in VARCHAR2,
349     object_type in VARCHAR2);
350 
351   -- The drop_template_object procedure is used to drop an object from
352   -- a template.
353   --
354   -- Arguments:
355   --   refresh_template_name - name of the deployment template
356   --   object_name - the name of the object to be deleted
357   --   object_type - the type of the object to be deleted Must be one of
358   --     'INDEX', 'TABLE','VIEW','SYNONYM','SEQUENCE','PROCEDURE','FUNCTION',
359   --     'PACKAGE','PACKAGE BODY','TRIGGER','SNAPSHOT','DATABASE LINK',
360   --     or 'MATERIALIZED VIEW'.
361   --
362   -- Exceptions:
363   --   miss_refresh_template - the specified template does not exist.
364   --   miss_template_object - the specified object does not exist.
365   --   bad_object_type - the object type is invalid.
366   --
367 
368   procedure drop_template_parm(
369     refresh_template_name in VARCHAR2,
370     parameter_name in varchar2);
371 
372   -- The drop_template_parm procedure drops a template parameter from
373   -- a template.
374   --
375   -- Arguments:
376   --   refresh_template_name - name of the deployment template
377   --   prameter_name - name of parameter to be dropped
378   --
379   -- Exceptions:
380   --   miss_refresh_template - the specified template does not exist.
381   --   miss_template_parm - the specified parameter does not exist.
382 
383   procedure drop_user_parm_value(
384     refresh_template_name in varchar2,
385     parameter_name in varchar2,
386     user_name in varchar2);
387 
388   -- The drop_user_parm_value procedure deletes a user_parm_value
389   -- from a template.
390   --
391   -- Arguments:
392   --   refresh_template_name - name of the deployment template
393   --   parameter_name - name of the parameter
394   --   user_name - name of user
395   --
396   -- Exceptions:
397   --   miss_refresh_template - the specified template does not exist.
398   --   miss_template_parm - the specified parameter does not exist.
399   --   miss_user - the specified user does not exist in the database
400   --
401 
402   procedure alter_user_authorization(
403     USER_NAME in VARCHAR2,
404     REFRESH_TEMPLATE_NAME in VARCHAR2,
405     new_USER_NAME in VARCHAR2 := '-',
406     new_REFRESH_TEMPLATE_NAME in VARCHAR2 := '-');
407 
408   -- The alter_user_authorization procedure changes the attributes
409   -- of an existing user_authorization.
410   --
411   -- Arguments:
412   --   user_name - database user name of the authorization.
413   --   refresh_template_name - name of the refresh_template
414   --   new_user_name - changed user_name
415   --   new_refresh_template_name - changed template name
416   --
417   -- Exceptions:
421   --     exists.
418   --   miss_refresh_template - the specified or new template is missing.
419   --   miss_user - the sepecified user_name or new_user_name does not exist
420   --   dupl_user_authorization - the changed user_authorization already
422 
423   procedure alter_refresh_template(
424     REFRESH_TEMPLATE_NAME in VARCHAR2,
425     new_OWNER in VARCHAR2 := '-',
426     new_REFRESH_GROUP_NAME in VARCHAR2 := '-',
427     new_REFRESH_TEMPLATE_NAME in VARCHAR2 := '-',
428     new_TEMPLATE_COMMENT in VARCHAR2 := '-',
429     new_PUBLIC_TEMPLATE in VARCHAR2 := '-',
430     new_LAST_MODIFIED in DATE := to_date('1', 'J'),
431     new_MODIFIED_BY in NUMBER := -1e-130);
432 
433   -- The alter_refresh_template procedure changes the attributes
434   -- of an existing deployment template.
435   --
436   -- Arguments:
437   --   refresh_template_name - name of the template to change
438   --   new_owner - new owner of the template
439   --   new_refresh_group_name - new refresh group name of the template
440   --   new_refresh_template_name - new template_name
441   --   new_public_template - new public template flag
442   --   new_last_modified - new last modified date
443   --   new_modified_by - new modified by user id
444   --
445   -- Exceptions:
446   --   miss_refresh_template - the specified template does not exist
447   --   bad_user - the new_owner does not exist as a database user
448   --   bad_public_template - the public template flag is not 'Y','N' or NULL
449   --   dupl_refresh_template - the new_refresh_template_name already exists
450 
451   procedure alter_template_object(
452     REFRESH_TEMPLATE_NAME in VARCHAR2,
453     OBJECT_NAME in VARCHAR2,
454     OBJECT_TYPE in VARCHAR2,
455     new_REFRESH_TEMPLATE_NAME in VARCHAR2 := '-',
456     new_OBJECT_NAME in VARCHAR2 := '-',
457     new_OBJECT_TYPE in VARCHAR2 := '-',
458     new_DDL_TEXT in clob := null,
459     new_MASTER_ROLLBACK_SEG in VARCHAR2 := '-',
460     new_FLAVOR_ID in NUMBER := -1e-130);
461 
462   -- The alter_template_object procedure changes the attributes of
463   -- a template object.
464   --
465   -- Arguments:
466   --   refresh_template_name - name of the deployment template
467   --   object_name - name of the object to be modified.
468   --   object_type - type of the object to be modified.
469   --   new_refresh_template_name - name of the new deployment template
470   --   new_object_name - name the object will be renamed to
471   --   new_object_type - new object type to rename the object to
472   --   new_ddl_text - updated ddl text
473   --   new_master_rollback_seg - new rollback segment name
474   --   new_flavor_id - updated flavor_id
475   --
476   -- Exceptions:
477   --   miss_refresh_template - missing deployment template name or new
478   --     template_name
479   --   miss_template_object - the object does not exist in the template
480   --   bad_object_type - the object type is not valid or the new object
481   --     type is not valid.
482   --   dupl_template_object - an object of the new name and type
483   --     already exists for the template.
484 
485   procedure alter_template_parm(
486     REFRESH_TEMPLATE_NAME in VARCHAR2,
487     PARAMETER_NAME in VARCHAR2,
488     new_REFRESH_TEMPLATE_NAME in VARCHAR2 := '-',
489     new_PARAMETER_NAME in VARCHAR2 := '-',
490     new_DEFAULT_PARM_VALUE in clob := null,
491     new_PROMPT_STRING in VARCHAR2 := '-',
492     new_USER_OVERRIDE in VARCHAR2 := '-');
493 
494   -- The alter_template_parm procedure changes the attributes of a
495   -- template parameter
496   --
497   -- Arguments:
498   --   refresh_template_name - name of the deployment template
499   --     containing the parameter
500   --   parameter_name - name of the parameter being changed
501   --   new_refresh_template_name - name of the new template that
502   --     the parameter is being assigned to
503   --   new_parameter_name - new parameter_name
504   --   new default_parm_value - new default value for the parameter
505   --   new_prompt_string - new prompt string for the parameter
506   --   new_user_override - new value for the user_orverride flag.
507   --
508   -- Exceptions:
509   --   miss_refresh_template -  missing deployment template name or new
510   --     template_name
511   --   miss_template_parm - the parameter is not defined for the template
512   --   dupl_template_parm - the new_parameter already exists for the template.
513   --
514 
515   procedure alter_user_parm_value(
516     REFRESH_TEMPLATE_NAME in VARCHAR2,
517     PARAMETER_NAME in VARCHAR2,
518     USER_NAME in VARCHAR2,
519     new_REFRESH_TEMPLATE_NAME in VARCHAR2 := '-',
520     new_PARAMETER_NAME  in VARCHAR2 := '-',
521     new_USER_NAME  in VARCHAR2 := '-',
522     new_PARM_VALUE in clob := null);
523 
524   -- The alter_user_parm_value procedure is used to change the
525   -- attributes of a user parameter value.
526   --
527   -- Arguments:
528   --   refresh_template_name - name of the template containing the
529   --     user parm value
530   --   parameter_name - name of the parameter
531   --   user_name - database user name
532   --   new_refresh_template_name - new template name containing the
533   --     user parm value
534   --   new_parameter_name - new parameter_name for the value
535   --   new_user_name - new user name for the parameter value
536   --   new_parm_value - new value for the parameter.
537   --
538   -- Exceptions:
539   --  miss_refresh_template - missing deployment template for template_name
540   --    or new_refresh_template_name
544   --    new_user_name
541   --  miss_template_parm - the parameter is not defined for the template
542   --    or new_parameter_name
543   --  miss_user - the user name is not defined for the user_name or
545   --  dupl_user_parm - the new user_parm_value already exists.
546 
547 
548   function copy_template(
549     old_refresh_template_name in varchar2,
550     new_refresh_template_name in varchar2,
551     copy_user_authorizations in varchar2,
552     dblink in varchar2 default null) return number;
553 
554   -- The copy_template function is used to create a new template from
555   -- an existing template.  Copy_template copies the entire template
556   -- including the object, parameters, user parameter values and,
557   -- optionally, the user authorizations associated with a template.
558   -- The copy_template function will also copy a template from another
559   -- database if a database link is supplied.
560   --
561   -- Arguments:
562   --   old_refresh_template_name - name of the template to copy from
563   --   new_refresh_template_name - name of the template to copy to
564   --   copy_user_authorizations - a 'Y' or 'N' flag used to specify
565   --     the copying of the user_authorizations associated with
566   --     the existing template
567   --   dblink - the database link to use when copying from another
568   --     database.  If not supplied, a local copy will be performed.
569   --
570   -- Exceptions:
571   --   miss_refresh_template - the copy from template does not exist
572   --   dupl_refresh_template - the copy to template already exists
573 
574   procedure drop_all_objects(refresh_template_name in varchar2,
575                              object_type in varchar2 default NULL);
576 
577   -- The drop_all_objects procedure drops all of the objects
578   -- associated with a template or, optionally, all of the objects
579   -- of a particular type in a template.
580   --
581   -- Arguments:
582   --   refresh_template_name - the name of the template containing the
583   --     objects
584   --   object_type - optional parameter specifying the object types to
585   --     delete.
586   --
587   -- Exceptions:
588   --   miss_refresh_template - the specified template does not exist
589   --   bad_object_type - the specified object_type is invalid
590 
591   procedure drop_all_user_parm_values(refresh_template_name in varchar2,
592                                 user_name in varchar2 default NULL,
593                                 parameter_name in varchar2 default NULL);
594 
595   -- The drop_all_user_parm_values procedure drops all of the
596   -- user_parm_values in a template, or, optionally, all the
597   -- user_parm_values for a particular user or with a particular
598   -- parameter_name
599   --
600   -- Arguments:
601   --   refresh_template_name - name of the template.
602   --   user_name - optional name of the user to delete user_parm_values for
603   --   parameter_name - optional parameter_name to delete
604   --     user_parm_values for.
605   --
606   -- Exceptions:
607   --   miss_refresh_template - the specified template does not exist.
608   --   miss_user - the specified user does not exist.
609   --   miss_template_parameter - the template_parameter specified
610   --     by parameter_name does not exist
611 
612   procedure drop_all_template_parms(refresh_template_name in varchar2,
613                                     drop_objects in varchar2 default 'N');
614 
615   -- The drop_all_template_parms procedure drops all of the template
616   -- parameters for a specified template.  Optionally, all of the
617   -- objects referencing the parameters may also be dropped.
618   --
619   -- Arguments:
620   --   refresh_template_name - the name of the template.
621   --   drop_objects - a 'Y' or 'N' flag specifying whether or not
622   --     to drop the associated objects.
623   --
624   -- Exceptions:
625   --   miss_refresh_template - the specified template does not exist.
626 
627   procedure drop_all_user_authorizations(refresh_template_name in varchar2);
628 
629   -- The drop_all_user_authorizations procedure drops all of the user
630   -- authorizations for a specified template.
631   --
632   -- Arguments:
633   --   refresh_template_name - the name of the template.
634   --
635   -- Exceptions:
636   --   miss_refresh_template - the specified template does not exist.
637 
638   procedure drop_all_templates;
639 
640   -- The drop_all_templates procedure drops all of the templates in a
641   -- database.  NOTE: THIS WILL DELETE ALL TEMPLATES.
642 
643   function  instantiate_online(refresh_template_name in varchar2,
644                                site_name in varchar2,
645                                user_name in varchar2 default NULL,
646                                runtime_parm_id in number default -1e-130,
647                                next_date in date default sysdate,
648                                interval in varchar2 default 'SYSDATE+1',
649                                use_default_gowner in boolean default TRUE)
650                                return number;
651 
652   -- The instantiate_online procedure is used to generate the ddl
653   -- required for an online instantiation.
654   --
655   -- Arguments:
656   --   refresh_template_name - name of the template
657   --   site_name - name of the site doing the instantiation
658   --   user_name - name of the user doing the instantiation.  This is
659   --     and optional parameter, and if not supplied, defaults to
663   --   interval - the refresh interval.  Also optional.
660   --     the connected user.
661   --   runtime_parm_id - runtime parameter id. This is an optional parameter.
662   --   next_date - next scheduled refresh date.  This is optional.
664   --   use_default_gowner - If true than the owner of any snapshot object
665   --     groups created will be owned by the default user, PUBLIC. Otherwise
666   --     the owner of snapshot object groups will be the user performing the
667   --     instantiation.
668   --
669   -- Return Values:
670   --   The return value of this function is an output_id.  This is
671   --   the primary key to the system.repcat$_temp_output table.  This is
672   --   where the generated DDL for the online instantiation.
673   --
674   -- Exceptions:
675   --   miss_refresh_template - the template is missing.
676   --   miss_user - the user specified by user_id is missing.
677 
678   FUNCTION instantiate_offline_java(
679         refresh_template_name IN VARCHAR2,
680         site_id               IN VARCHAR2,
681         user_name             IN VARCHAR2,
682         master                IN VARCHAR2,
683         url                   IN VARCHAR2,
684         ssl                   IN NUMBER,
685         offline_dirpath       IN VARCHAR2,
686         file_name             IN VARCHAR2,
687         trace_vector          IN NUMBER,
688         resultset_threshold   IN NUMBER,
689         lob_threshold         IN NUMBER) RETURN NUMBER;
690 
691   function instantiate_offline(refresh_template_name in varchar2,
692                                site_name in varchar2,
693                                user_name in varchar2 default NULL,
694                                runtime_parm_id in number default -1e-130,
695                                next_date in date default sysdate,
696                                interval in varchar2 default 'SYSDATE+1',
697                                use_default_gowner in boolean default TRUE,
698                                dest_dbversion in number default NULL)
699                                return number;
700 
701   -- The instantiate_offline procedure is used to generate the ddl
702   -- required for an offline instantiation for server snapshots.
703   --
704   -- Arguments:
705   --   refresh_template_name - name of the template
706   --   site_name - name of the site doing the instantiation
707   --   user_name - name of the user doing the instantiation.  This is
708   --     and optional parameter, and if not supplied, defaults to
709   --     the connected user.
710   --   runtime_parm_id - runtime parameter id. This is an optional parameter.
711   --   next_date - next scheduled refresh date.  This is optional.
712   --   interval - the refresh interval.  Also optional.
713   --   use_default_gowner - If true than the owner of any snapshot object
714   --     groups created will be owned by the default user, PUBLIC. Otherwise
715   --     the owner of snapshot object groups will be the user performing the
716   --     instantiation.
717   --   dest_dbversion: database version of the site where template
718   --                    will be instantiated. For example: 8.2, 8.1
719   --                    default value of NULL indicates
720   --                    that the local database compatibility will be used.
721   -- Return Values:
722   --   The return value of this function is an output_id.  This is
723   --   the primary key to the system.repcat$_temp_output table.  This is
724   --   where the generated DDL for the offline instantiation.
725   --
726   -- Exceptions:
727   --   miss_refresh_template - the template is missing.
728   --   miss_user - the user specified by user_id is missing.
729   --  reftmplinvalidcomp - template can not be instantiate to database with
730   --   compatiblity is 8.0-
731   FUNCTION instantiate_offline_repapi(
732    refresh_template_name IN VARCHAR2,
733    site_id               IN VARCHAR2 DEFAULT NULL,
734    user_name             IN VARCHAR2 DEFAULT USER,
735    master                IN VARCHAR2 DEFAULT NULL,
736    url                   IN VARCHAR2 DEFAULT NULL,
737    ssl                   IN NUMBER   DEFAULT 0,
738    offline_dirpath       IN VARCHAR2 DEFAULT NULL,
739    trace_vector          IN NUMBER DEFAULT DBMS_REPCAT_RGT.NO_TRACE_DUMP,
740    resultset_threshold   IN NUMBER DEFAULT DBMS_REPCAT_RGT.RESULTSET_THRESHOLD,
741    lob_threshold         IN NUMBER DEFAULT DBMS_REPCAT_RGT.LOB_THRESHOLD
742   )
743   RETURN NUMBER;
744 
745   -- The instantiate_offline_repapi function performs a server side
746   -- offline instantiation of a repapi based template.
747   --
748   -- Arguments:
749   --   refresh_template_name - name of the template to offline instantiate
750   --   site_id - repapi site_id of the site instantiating for
751   --   user_name - the user who will own the refresh group.  This is
752   --     and optional parameter, and if not supplied, defaults to
753   --     the logon user.
754   --   master - an alias used for the URL by the JAVA REPAPI client
755   --   url - service name with which the JAVA REPAPI server is published
756   --   ssl - a boolean which determines whether SSL is to be used with the URL
757   --   offline_dirpath - directory path for the offline file
758   --   trace_vector - trace level for debugging
759   --   resultset_threshold - buffer size for outputing result sets
760   --   lob_threshold - buffer size for outputing lob values
761 
762 
763   function create_object_from_existing(refresh_template_name in varchar2,
764                                        object_name in varchar2,
768 
765                                        sname in varchar2,
766                                        oname in varchar2,
767                                        otype in varchar2) return number;
769   -- The create_object_from_existing creates a template object from
770   -- an existing object in the database.
771   --
772   -- Arguments:
773   --   refresh_template_name - name of the template
774   --   object_name - name of the new object
775   --   sname - schema name of the schema containing the existing object
776   --   oname - name of the existing object
777   --   otype - object type of the existing object.
778   --
779   -- Return values:
780   --   The return value of this function is the id of the new object.
781   --
782   -- Exceptions:
783   --   miss_refresh_template - the template is missing.
784   --   dupl_template_object - the object specified by the object_name
785   --     already exists.
786   --   bad_object - the object specified by sname, oname and otype
787   --     does not exist or is invalid.
788 
789   function get_runtime_parm_id return number;
790 
791   -- The get_runtime_parm_id function gets a runtime parameter id.
792   -- This is used to insert runtime parameters prior to
793   -- instantiation.
794   --
795   -- Arguments:
796   --   none.
797   --
798   -- Exceptions:
799   --   none.
800 
801   procedure insert_runtime_parms(runtime_parm_id in number,
802                                  parameter_name in varchar2,
803                                  parameter_value in clob);
804 
805   -- The insert_runtime_parms procedure is used to insert values
806   -- into the runtime parameters table.  Prior to calling this procedure
807   -- a call should have been made to get_runtime_parm_id.  All of the
808   -- parameters for an instantiation should have the sane runtime_parm_id.
809   --
810   -- Arguments:
811   --   runtime_parm_id - unique_id obtained from get_runtime_parm_id call.
812   --   parameter_name - name of the parameter for the value.
813   --   parameter_value - value of the parameter.
814   --
815   -- Exceptions:
816   --   none.
817 
818   procedure delete_runtime_parms(runtime_parm_id in number,
819                                  parameter_name in varchar2);
820 
821   -- The delete_runtime_parms procedure is used to delete
822   -- previously inserted runtime parameters.
823   --
824   -- Arguments:
825   --   runtime_parm_id - id of the rows to be deleted.
826   --   parameter_name - name of the parameter to delete.
827   --
828   -- Exceptions:
829   --   none.
830 
831   procedure lock_template_shared;
832 
833   -- The lock_template_shared procedure is used to prevent changes to
834   -- a template during the instantiation of the template.  This should
835   -- be called prior to instantiate_online or instantiate_offline.  The
836   -- lock is cleared by performing a commit or rollback.
837   --
838   -- Arguments:
839   --   none.
840   --
841   -- Exceptions:
842   --   none.
843 
844 
845   procedure lock_template_exclusive;
846 
847   -- The lock_template_exclusive procedure is used to prevent instantiation
848   -- a template while changes are being made to a template.  This should
849   -- be called prior to making any changes to the template.  The lock is
850   -- cleared by performing a commit or rollback.
851   --
852   -- Arguments:
853   --   none.
854   --
855   -- Exceptions:
856   --   none.
857 
858   function compare_templates(source_template_name in varchar2,
859                              compare_template_name in varchar2)
860                              return number;
861 
862   -- The compare_templates procedure is used to compare two templates.
863   -- The results of the comparison are placed in the the
864   -- system.repcat$_temp_output table.  If there are no differences,
865   -- no rows are written to the table.
866   --
867   -- Arguments:
868   --   source_template_name - name of the first template.
869   --   compare_template_name - name of the second template.
870   --
871   -- Return value:
872   --   The return value is the output_id key of the repcat$_temp_output table.
873   --
874   -- Exceptions:
875   --   miss_refresh_template - either the source_template_name does not
876   --     exist, or the compare_template_name does not exist, or both.
877 
878 
879   procedure drop_site_instantiation(
880     REFRESH_TEMPLATE_NAME in VARCHAR2,
881     USER_NAME in VARCHAR2,
882     SITE_NAME in VARCHAR2,
883     REPAPI_SITE_ID in NUMBER DEFAULT -1e-130,
884     PROCESS_REPAPI_SITE in VARCHAR2 DEFAULT 'N'
885   );
886 
887   -- The drop_site_instantiation procedure is used to drop the instantiation
888   -- of a template.  This alters the snapshot so that is cannot be
889   -- refreshed.  This is used for both server and repapi snapshots.
890   --
891   -- Arguments:
892   --   refresh_template_name - name of the template.
893   --   user_name - name of the user that instantiated the template.
894   --   site_name - site where the template was instantiated.
895   --   repapi_site_id - the numeric  id of repapi sites. If this is non-NULL
896   --     then it is assumed to be a repapi site. The site_name may or may not
897   --     be provided. If the site_name is also provided then the site_name
898   --     must be a valid repapi site whose id is repapi_site_id.
902   --
899   --   process_repapi_site - if this flag is 'Y' then the site_name is assumed
900   --      to be a repapi site_name. The default value is 'N'. This flag has no
901   --      relevance if repapi_site_id is non-NULL.
903   -- Exceptions:
904   --   miss_refresh_template - template does not exist.
905   --   miss_user - user_name does not exist in the database.
906   --   miss_template_site - template has not been instantiated for
907   --     user and site.
908 
909 
910   ---------------------------------------------------------------------------
911   ---
912   --- #######################################################################
913   --- #######################################################################
914   ---                        INTERNAL PROCEDURES
915   ---
916   --- The following procedures provide internal functionality and should
917   --- not be called directly. Invoking these procedures may corrupt your
918   --- replication environment.
919   ---
920   --- #######################################################################
921   --- #######################################################################
922 
923   function vc2_from_clob(lobstring in clob,
924                          len       in number default 32767) return varchar2;
925   pragma restrict_references(vc2_from_clob,WNDS);
926 
927   function clob_from_vc2(vc2string in varchar2) return clob;
928 
929   function check_ddl_text(ddl_text in clob,
930                           object_type in varchar2,
931                           user_name in varchar2) return number;
932 
933 
934   function read_clob(clobval  in clob,
935                      vcval    in out varchar2,
936                      readsize in number,
937                      offset   in number) return number;
938 
939   procedure substitute_parameters(
940     refresh_template_name in varchar2,
941     object_name in varchar2,
942     object_type in varchar2,
943     user_name in varchar2,
944     ddl_string out clob);
945 
946   procedure substitute_parameters(
947     refresh_template_id in number,
948     template_object_id in number,
949     user_id in number,
950     ddl_string out clob);
951 
952 
953 end "DBMS_REPCAT_RGT";