Skip Headers

Oracle9i Supplied PL/SQL Packages and Types Reference
Release 2 (9.2)

Part Number A96612-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Logical Change Record Types, 2 of 6


LCR$_DDL_RECORD Type

This type represents a DDL change to a database object.

If you create or modify a DDL LCR, then make sure the ddl_text is consistent with the base_table_name, base_table_owner, object_type, object_owner, object_name, and command_type attributes.


Note:
  • When passing a name as a parameter to an LCR constructor, you can enclose the name in double quotes to handle names that use mixed case or lower case for database objects. For example, if a name contains any lower case characters, then you must enclose it in double quotes.
  • The application does not need to specify a transaction identifier or SCN when it creates an LCR because the apply process generates these values and stores them in memory. If a transaction identifier or SCN is specified in the LCR, then the apply process ignores it and assigns a new value.

LCR$_DDL_RECORD Constructor

Creates a SYS.LCR$_DDL_RECORD object with the specified information.

STATIC FUNCTION CONSTRUCT(
   source_database_name       IN VARCHAR2,
   command_type               IN VARCHAR2,
   object_owner               IN VARCHAR2,
   object_name                IN VARCHAR2,
   object_type                IN VARCHAR2,
   ddl_text                   IN CLOB,
   logon_user                 IN VARCHAR2,
   current_schema             IN VARCHAR2,
   base_table_owner           IN VARCHAR2,
   base_table_name            IN VARCHAR2,
   tag                        IN RAW       DEFAULT NULL,
   transaction_id             IN VARCHAR2  DEFAULT NULL,
   scn                        IN NUMBER    DEFAULT NULL) 
RETURN SYS.LCR$_DDL_RECORD;

LCR$_DDL_RECORD Constructor Function Parameters

Table 108-1 Constructor Function Parameters for LCR$_DDL_RECORD (Page 1 of 3)
Parameter Description

source_database_name

The database where the DDL statement occurred. If you do not include the domain name, then the local domain is appended to the database name automatically. For example, if you specify DBS1 and the local domain is .NET, then DBS1.NET is specified automatically. This parameter should be set to a non-NULL value.

command_type

The type of command executed in the DDL statement. This parameter should be set to a non-NULL value.

See Also: The "SQL Command Codes" table in the Oracle Call Interface Programmer's Guide for a complete list of command types

The following command types are not supported in DDL LCRs:

ALTER MATERIALIZED VIEW
ALTER MATERIALIZED VIEW LOG
ALTER SUMMARY
CREATE SCHEMA
CREATE MATERIALIZED VIEW
CREATE MATERIALIZED VIEW LOG
CREATE SUMMARY
DROP MATERIALIZED VIEW
DROP MATERIALIZED VIEW LOG
DROP SUMMARY
RENAME

The snapshot equivalents of the materialized view command types are also not supported.

object_owner

The user who owns the object on which the DDL statement was executed

object_name

The database object on which the DDL statement was executed

object_type

The type of object on which the DDL statement was executed.

The following are valid object types:

CLUSTER
FUNCTION
INDEX
LINK
OUTLINE
PACKAGE
PACKAGE BODY
PROCEDURE
SEQUENCE
SYNONYM
TABLE
TRIGGER
TYPE
USER
VIEW

LINK represents a database link.

NULL is also a valid object type. Specify NULL for all object types not listed. The GET_OBJECT_TYPE member procedure returns NULL for object types not listed.

ddl_text

The text of the DDL statement. This parameter should be set to a non-NULL value.

logon_user

The user whose session executed the DDL statement

current_schema

The schema that is used if no schema is specified explicitly for the modified database objects in ddl_text. If a schema is specified in ddl_text that differs from the one specified for current_schema, then the schema specified in ddl_text is used.

This parameter should be set to a non-NULL value.

base_table_owner

If the DDL statement is a table related DDL (such as CREATE TABLE and ALTER TABLE), or if the DDL statement involves a table (such as creating a trigger on a table), then base_table_owner specifies the owner of the table involved. Otherwise, base_table_owner is NULL.

base_table_name

If the DDL statement is a table related DDL (such as CREATE TABLE and ALTER TABLE), or if the DDL statement involves a table (such as creating a trigger on a table), then base_table_name specifies the name of the table involved. Otherwise, base_table_name is NULL.

tag

A binary tag that enables tracking of the LCR. For example, this tag may be used to determine the original source database of the DDL statement if apply forwarding is used.

See Also: Oracle9i Streams for more information about tags

transaction_id

The identifier of the transaction

scn

The SCN at the time when the change record for a captured LCR was written to the redo. The SCN value is meaningless for a user-created LCR.

Summary of LCR$_DDL_RECORD Subprograms

Table 108-2 LCR$_DDL_RECORD Subprograms 
Subprogram Description

Common Subprograms

See "Common Subprograms for LCR$_ROW_RECORD and LCR$_DDL_RECORD" for a list of subprograms common to the SYS.LCR$_ROW_RECORD and SYS.LCR$_DDL_RECORD types

"EXECUTE Member Procedure"

Executes the LCR under the security domain of the current user

"GET_BASE_TABLE_NAME Member Function"

Returns the base (dependent) table name

"GET_BASE_TABLE_OWNER Member Function"

Returns the base (dependent) table owner

"GET_CURRENT_SCHEMA Member Function"

Returns the default schema (user) name

"GET_DDL_TEXT Member Procedure"

Gets the DDL text in a CLOB

"GET_LOGON_USER Member Function"

Returns the logon user name

"GET_OBJECT_TYPE Member Function"

Returns the type of the object involved for the DDL

"SET_BASE_TABLE_NAME Member Procedure"

Sets the base (dependent) table name

"SET_BASE_TABLE_OWNER Member Procedure"

Sets the base (dependent) table owner

"SET_CURRENT_SCHEMA Member Procedure"

Sets the default schema (user) name

"SET_DDL_TEXT Member Procedure"

Sets the DDL text

"SET_LOGON_USER Member Procedure"

Sets the logon user name

"SET_OBJECT_TYPE Member Procedure"

Sets the object type

EXECUTE Member Procedure

Executes the DDL LCR under the security domain of the current user. Any apply process handlers that would be run for an LCR are not run when the LCR is applied using this procedure.


Note:

The EXECUTE member procedure can be invoked only in an apply handler for an apply process.


Syntax
MEMBER PROCEDURE EXECUTE();

GET_BASE_TABLE_NAME Member Function

Returns the base (dependent) table name.

Syntax
MEMBER FUNCTION GET_BASE_TABLE_NAME RETURN VARCHAR2;

GET_BASE_TABLE_OWNER Member Function

Returns the base (dependent) table owner.

Syntax
MEMBER FUNCTION GET_BASE_TABLE_OWNER RETURN VARCHAR2;

GET_CURRENT_SCHEMA Member Function

Returns the current schema name.

Syntax
MEMBER FUNCTION GET_CURRENT_SCHEMA RETURN VARCHAR2;

GET_DDL_TEXT Member Procedure

Gets the DDL text in a CLOB.

The following is an example of a PL/SQL procedure that uses this procedure to get the DDL text in a DDL LCR:

CREATE OR REPLACE PROCEDURE ddl_in_lcr (ddl_lcr in SYS.LCR$_DDL_RECORD)
IS
  ddl_text   CLOB;
BEGIN
  DBMS_OUTPUT.PUT_LINE( '  -----------------------------------------' ); 
  DBMS_OUTPUT.PUT_LINE( '  Displaying DDL text in a DDL LCR: ' );
  DBMS_OUTPUT.PUT_LINE( '  -----------------------------------------' ); 
  DBMS_LOB.CREATETEMPORARY(ddl_text, TRUE);
  ddl_lcr.GET_DDL_TEXT(ddl_text);
  DBMS_OUTPUT.PUT_LINE('DDL text:' || ddl_text);
  DBMS_LOB.FREETEMPORARY(ddl_text);
END;
/

Note:

GET_DDL_TEXT is a member procedure and not a member function to make it easier for you to manage the space used by the CLOB. Notice that the previous example creates temporary space for the CLOB and then frees the temporary space when it is no longer needed.


Syntax
MEMBER FUNCTION GET_DDL_TEXT
  ddl_text  IN OUT  CLOB);
Parameter
Table 108-3 GET_DDL_TEXT Procedure Parameter
Parameter Description

ddl_text

The DDL text in the DDL LCR

GET_LOGON_USER Member Function

Returns the logon user name.

Syntax
MEMBER FUNCTION GET_LOGON_USER RETURN VARCHAR2;

GET_OBJECT_TYPE Member Function

Returns the type of the object involved for the DDL.

Syntax
MEMBER FUNCTION GET_OBJECT_TYPE RETURN VARCHAR2;

SET_BASE_TABLE_NAME Member Procedure

Sets the base (dependent) table name.

Syntax
MEMBER PROCEDURE SET_BASE_TABLE_NAME(
     base_table_name IN VARCHAR2);
Parameter
Table 108-4 SET_BASE_TABLE_NAME Procedure Parameter
Parameter Description

base_table_name

The name of the base table

SET_BASE_TABLE_OWNER Member Procedure

Sets the base (dependent) table owner.

Syntax
MEMBER PROCEDURE SET_BASE_TABLE_OWNER(
     base_table_owner IN VARCHAR2);
Parameter
Table 108-5 SET_BASE_TABLE_OWNER Procedure Parameter
Parameter Description

base_table_owner

The name of the base owner

SET_CURRENT_SCHEMA Member Procedure

Sets the default schema (user) name.

Syntax
MEMBER PROCEDURE SET_CURRENT_SCHEMA(
     current_schema IN VARCHAR2);
Parameter
Table 108-6 SET_CURRENT_SCHEMA Procedure Parameter
Parameter Description

current_schema

The name of the schema to set as the current schema. This parameter should be set to a non-NULL value.

SET_DDL_TEXT Member Procedure

Sets the DDL text.

Syntax
MEMBER PROCEDURE SET_DDL_TEXT(
    ddl_text     IN CLOB);
Parameter
Table 108-7 SET_DDL_TEXT Procedure Parameter
Parameter Description

ddl_text

The DDL text. This parameter should be set to a non-NULL value.

SET_LOGON_USER Member Procedure

Sets the logon user name.

Syntax
MEMBER PROCEDURE SET_LOGON_USER(
     logon_user IN VARCHAR2);
Parameter
Table 108-8 SET_LOGON_USER Procedure Parameter
Parameter Description

logon_user

The name of the schema to set as the logon user

SET_OBJECT_TYPE Member Procedure

Sets the object type.

Syntax
MEMBER PROCEDURE SET_OBJECT_TYPE(
     object_type    IN VARCHAR2);
Parameter
Table 108-9 SET_OBJECT_TYPE Procedure Parameter
Parameter Description

object_type

The object type.

The following are valid object types:

CLUSTER
FUNCTION
INDEX
LINK
OUTLINE
PACKAGE
PACKAGE BODY
PROCEDURE
SEQUENCE
SYNONYM
TABLE
TRIGGER
TYPE
USER
VIEW

LINK represents a database link.

NULL is also a valid object type. Specify NULL for all object types not listed. The GET_OBJECT_TYPE member procedure returns NULL for object types not listed.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2000, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback