Skip Headers

Oracle® Database Advanced Replication Management API Reference
10g Release 1 (10.1)

Part Number B10733-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to current chapter
Up
Go to next page
Next
View PDF

CREATE_TEMPLATE_OBJECT Function

This function adds object definitions to a target deployment template container. The specified object DDL is executed when the target deployment template is instantiated at the remote materialized view site. In addition to adding materialized views, this function can add tables, procedures, and other objects to your template. The number returned by this function is used internally by Oracle to manage deployment templates.

Syntax

DBMS_REPCAT_RGT.CREATE_TEMPLATE_OBJECT (
   refresh_template_name  IN   VARCHAR2, 
   object_name            IN   VARCHAR2, 
   object_type            IN   VARCHAR2,
   ddl_text               IN   CLOB,
   master_rollback_seg    IN   VARCHAR2 := NULL,
   flavor_id              IN   NUMBER := -1e-130)
  return NUMBER;

Parameters

Table 21-24 CREATE_TEMPLATE_OBJECT Function Parameters  
Parameter Description
refresh_template_name

Name of the deployment template to which you want to add this object.

object_name

Name of the template object that you are creating.

object_type

The type of database object that you are adding to the template (that is, MATERIALIZED VIEW, TRIGGER, PROCEDURE, and so on). Objects of the following type may be specified:

MATERIALIZED VIEW     PROCEDURE
INDEX                 FUNCTION
TABLE                 PACKAGE
VIEW                  PACKAGE BODY
SYNONYM               TRIGGER
SEQUENCE              DATABASE LINK

ddl_text

Contains the DDL that creates the object that you are adding to the template. Be sure to end your DDL with a semi-colon. You can use a colon (:) to create a template parameter for your template object. See Chapter 4, "Create a Deployment Template" for more information.

When you add a materialized view with a CREATE MATERIALIZED VIEW statement, make sure you specify the schema name of the owner of the master table in the materialized view query.

master_rollback_seg

Specifies the name of the rollback segment to use when executing the defined object DDL at the remote materialized view site.

flavor_id

This parameter is for internal use only.

Note: Do not set this parameter unless directed to do so by Oracle Support Services.

Exceptions

Table 21-25 CREATE_TEMPLATE_OBJECT Function Exceptions  
Exception Description
miss_refresh_template

Specified refresh template name is invalid or missing. Query the DBA_REPCAT_REFRESH_TEMPLATES view for a list of existing deployment templates.

bad_object_type

Object type is specified incorrectly. See Table 21-24 for a list of valid object types.

dupl_template_object

An object of the same name and type has already been added to the specified deployment template.

Returns

Table 21-26 CREATE_TEMPLATE_OBJECT Function Returns
Return Value Description

<system-generated number>

System-generated number used internally by Oracle.

Usage Notes

Because CREATE_TEMPLATE_OBJECT utilizes a CLOB, you must use the DBMS_LOB package when using the CREATE_TEMPLATE_OBJECT function. The following example illustrates how to use the DBMS_LOB package with the CREATE_TEMPLATE_OBJECT function:

DECLARE
   tempstring VARCHAR2(100);
   templob CLOB;
   a NUMBER;
BEGIN
   DBMS_LOB.CREATETEMPORARY(templob, TRUE, DBMS_LOB.SESSION);
   tempstring := 'CREATE MATERIALIZED VIEW mview_sales AS SELECT *
        FROM sales WHERE salesperson = :salesid';
   DBMS_LOB.WRITE(templob, length(tempstring), 1, tempstring);
   a := DBMS_REPCAT_RGT.CREATE_TEMPLATE_OBJECT(
        refresh_template_name => 'rgt_personnel',
        object_name => 'mview_sales',
        object_type => 'MATERIALIZED VIEW',
        ddl_text => templob,
        master_rollback_seg => 'RBS');
   DBMS_LOB.FREETEMPORARY(templob);
END;
/