Skip Headers

PL/SQL Packages and Types Reference
10g Release 1 (10.1)

Part Number B10802-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 next page
Next
View PDF

174
Logical Change Record TYPEs

This chapter describes the logical change record (LCR) types. In Streams, LCRs are message payloads that contain information about changes to a database. These changes can include changes to the data, which are data manipulation language (DML) changes, and changes to database objects, which are data definition language (DDL) changes.

When you use Streams, the capture process captures changes in the form of LCRs and enqueues them into a queue. These LCRs can be propagated from a queue in one database to a queue in another database. Finally, the apply process can apply LCRs at a destination database. You also have the option of creating, enqueuing, and dequeuing LCRs manually.

See Also:

Oracle Streams Concepts and Administration for more information about LCRs

This chapter contains these topics:


Summary of Logical Change Record Types

Table 174-1 Logical Change Record (LCR) Types
Type Description

"LCR$_DDL_RECORD Type"

Represents a data definition language (DDL) change to a database object

"LCR$_ROW_RECORD Type"

Represents a data manipulation language (DML) change to a database object

"LCR$_ROW_LIST Type"

Identifies a list of column values for a row in a table

"LCR$_ROW_UNIT Type"

Identifies the value for a column in a row

These LCR types can be used with the following Oracle-supplied PL/SQL packages:


LCR$_DDL_RECORD Type

This type represents a data definition language (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.

This section contains information about the constructor for DDL LCRs and information about the member subprograms for this type:

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 174-2  Constructor Function Parameters for LCR$_DDL_RECORD
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: Oracle Streams Replication Administrator's Guide 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 log. The SCN value is meaningless for a user-created LCR.

Summary of LCR$_DDL_RECORD Subprograms

Table 174-3  LCR$_DDL_RECORD Type Subprograms
Subprogram Description

"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

Common Subprograms

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

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 174-4 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 174-5 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 174-6 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 174-7 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 174-8 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 174-9 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 174-10 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.


LCR$_ROW_RECORD Type

This type represents a data manipulation language (DML) change to a row in a table. This type uses the LCR$_ROW_LIST type.

If you create or modify a row LCR, then make sure the command_type attribute is consistent with the presence or absence of old column values and the presence or absence of new column values.

This section contains information about the constructor for DDL LCRs and information about the member subprograms for this type:

LCR$_ROW_RECORD Constructor

Creates a SYS.LCR$_ROW_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,
   tag                   IN  RAW                DEFAULT NULL,
   transaction_id        IN  VARCHAR2           DEFAULT NULL,
   scn                   IN  NUMBER             DEFAULT NULL,
   old_values            IN  SYS.LCR$_ROW_LIST  DEFAULT NULL,
   new_values            IN  SYS.LCR$_ROW_LIST  DEFAULT NULL)
RETURN SYS.LCR$_ROW_RECORD;
LCR$_ROW_RECORD Constructor Function Parameters
Table 174-11  Constructor Function Parameters for LCR$_ROW_RECORD
Parameter Description

source_database_name

The database where the row change 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 DML statement. This parameter should be set to a non-NULL value.

Valid values are the following:

INSERT
UPDATE
DELETE
LOB ERASE
LOB WRITE
LOB TRIM

If INSERT, then an LCR should have a new_values collection that is not empty and an empty or NULL old_values collection.

If UPDATE, then an LCR should have a new_values collection that is not empty and an old_values collection that is not empty.

If DELETE, then an LCR should have a NULL or empty new_values collection and an old_values collection that is not empty.

If LOB ERASE, LOB WRITE, or LOB TRIM, then an LCR should have a new_values collection that is not empty and an empty or NULL old_values collection.

object_owner

The user who owns the table on which the row change occurred. This parameter should be set to a non-NULL value.

object_name

The table on which the DML statement was executed. This parameter should be set to a non-NULL value.

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 DML change when apply forwarding is used.

See Also: Oracle Streams Replication Administrator's Guide for more information about tags

transaction_id

The identifier of the transaction

scn

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

old_values

The column values for the row before the DML change. If the DML statement is an UPDATE or a DELETE statement, then the values of columns in the row before the DML statement. If the DML statement is an INSERT statement, then there are no old values.

new_values

The column values for the row after the DML change. If the DML statement is an UPDATE or an INSERT statement, then the values of columns in the row after the DML statement. If the DML statement is a DELETE statement, then there are no new values.

If the LCR reflects a LOB operation, then the supplementally logged columns and any relevant LOB information.

Summary of LCR$_ROW_RECORD Subprograms

Table 174-12  LCR$_ROW_RECORD Type Subprograms
Subprogram Description

"ADD_COLUMN Member Procedure"

Adds the value as old or new, depending on the value type specified, for the column

"CONVERT_LONG_TO_LOB_CHUNK Member Procedure"

Converts LONG data in a row LCR into fixed width CLOB, or converts LONG RAW data in a row LCR into a BLOB

"DELETE_COLUMN Member Procedure"

Deletes the old value, the new value, or both, for the specified column, depending on the value type specified

"EXECUTE Member Procedure"

Executes the LCR under the security domain of the current user

"GET_LOB_INFORMATION Member Function"

Gets the LOB information for the column

"GET_LOB_OFFSET Member Function"

Returns the LOB offset for the specified column

"GET_LOB_OPERATION_SIZE Member Function"

Gets the operation size for the LOB column

"GET_LONG_INFORMATION Member Function"

Gets the LONG information for the column

"GET_VALUE Member Function"

Returns the old or new value for the specified column, depending on the value type specified

"GET_VALUES Member Function"

Returns a list of old or new values, depending on the value type specified

"RENAME_COLUMN Member Procedure"

Renames a column in an LCR

"SET_LOB_INFORMATION Member Procedure"

Sets LOB information for the column

"SET_LOB_OFFSET Member Procedure"

Sets the LOB offset for the specified column

"SET_LOB_OPERATION_SIZE Member Procedure"

Sets the operation size for the LOB column

"SET_VALUE Member Procedure"

Overwrites the value of the specified column

"SET_VALUES Member Procedure"

Replaces the existing old or new values for the LCR, depending on the value type specified

Common Subprograms

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

ADD_COLUMN Member Procedure

Adds the value as old or new, depending on the value type specified, for the column. An error is raised if a value of the same type already exists for the column.

To set a column value that already exists, run SET_VALUE.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure on a LOB column.


See Also:

"SET_VALUE Member Procedure"

Syntax
MEMBER PROCEDURE ADD_COLUMN(
   value_type    IN  VARCHAR2,
   column_name   IN  VARCHAR2,
   column_value  IN  SYS.AnyData);
Parameters
Table 174-13 ADD_COLUMN Procedure Parameters
Parameter Description

value_type

The type of value to add for the column. Specify old to add the old value of the column. Specify new to add the new value of the column.

column_name

The column name. This name is not validated. An error may be raised during application of the LCRs if an invalid name is specified.

column_value

The value of the column. If NULL, then an error is raised.

A NULL column value can be specified by encapsulating the NULL value in a SYS.AnyData wrapper.

CONVERT_LONG_TO_LOB_CHUNK Member Procedure

Converts LONG data in a row LCR into a CLOB, or converts LONG RAW data in a row LCR into a BLOB.

This procedure may change the operation code from LONG_WRITE to LOB_WRITE for the row LCR.

This procedure may be used in rule-based transformations and apply handlers.

The following restrictions apply to this member procedure:

Syntax
MEMBER PROCEDURE CONVERT_LONG_TO_LOB_CHUNK();

DELETE_COLUMN Member Procedure

Deletes the old value, the new value, or both, for the specified column, depending on the value type specified.

Syntax
MEMBER PROCEDURE DELETE_COLUMN(
   column_name  IN  VARCHAR2,
   value_type   IN  VARCHAR2  DEFAULT '*');
Parameters
Table 174-14 DELETE_COLUMN Procedure Parameters
Parameter Description

column_name

The column name. An error is raised if the column does not exist in the LCR.

value_type

The type of value to delete for the column. Specify old to delete the old value of the column. Specify new to delete the new value of the column. If * is specified, then both the old and new values are deleted.

EXECUTE Member Procedure

Executes the row 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(
   conflict_resolution  IN  BOOLEAN);
Parameters
Table 174-15 EXECUTE Procedure Parameters
Parameter Description

conflict_resolution

If true, then any conflict resolution defined for the table using the SET_UPDATE_CONFLICT_HANDLER procedure in the DBMS_APPLY_ADM package is used to resolve conflicts resulting from the execution of the LCR.

If false, then conflict resolution is not used.

GET_LOB_INFORMATION Member Function

Gets the LOB information for the column.

The return value can be one of the following:

DBMS_LCR.NOT_A_LOB        CONSTANT NUMBER := 1;
DBMS_LCR.NULL_LOB         CONSTANT NUMBER := 2;
DBMS_LCR.INLINE_LOB       CONSTANT NUMBER := 3;
DBMS_LCR.EMPTY_LOB        CONSTANT NUMBER := 4;
DBMS_LCR.LOB_CHUNK        CONSTANT NUMBER := 5;
DBMS_LCR.LAST_LOB_CHUNK   CONSTANT NUMBER := 6;

Returns NULL if the specified column does not exist.

If the command type of the row LCR is UPDATE, then specifying 'Y' for the use_old parameter is a convenient way to get the value of the columns.

Syntax
MEMBER FUNCTION GET_LOB_INFORMATION(
  value_type   IN  VARCHAR2,
  column_name  IN  VARCHAR2,
  use_old      IN  VARCHAR2  DEFAULT 'Y') 
RETURN NUMBER;
Parameters
Table 174-16 GET_LOB_INFORMATION Function Parameters
Parameter Description

value_type

The type of value to return for the column, either old or new

column_name

The name of the column

use_old

If Y and value_type is new, and no new value exists, then returns the corresponding old value. If N and value_type is new, then does not return the old value if no new value exists.

If value_type is old or if the command_type of the row LCR is not UPDATE, then the value of the use_old parameter is ignored.

NULL is not a valid specification for the use_old parameter.

GET_LOB_OFFSET Member Function

Gets the LOB offset for the specified column in the number of characters for CLOB columns and the number of bytes for BLOB columns. Returns a non-NULL value only if all of the following conditions are met:

Otherwise, returns NULL.

Syntax
GET_LOB_OFFSET(
   value_type   IN  VARCHAR2,
   column_name  IN  VARCHAR2) 
RETURN NUMBER;

Parameters
Table 174-17 GET_LOB_OFFSET Procedure Parameters
Parameter Description

value_type

The type of value to return for the column. Currently, only new can be specified.

column_name

The name of the LOB column

GET_LOB_OPERATION_SIZE Member Function

Gets the operation size for the LOB column in the number of characters for CLOB columns and the number of bytes for BLOB columns. Returns a non-NULL value only if all of the following conditions are met:

Otherwise, returns NULL.

Syntax
MEMBER FUNCTION GET_LOB_OPERATION_SIZE(
  value_type   IN  VARCHAR2,
  column_name  IN  VARCHAR2) 
RETURN NUMBER,
Parameters
Table 174-18 GET_LOB_OPERATION_SIZE Function Parameters
Parameter Description

value_type

The type of value to return for the column. Currently, only new can be specified.

column_name

The name of the LOB column

GET_LONG_INFORMATION Member Function

Gets the LONG information for the column.

The return value can be one of the following:

DBMS_LCR.NOT_A_LONG        CONSTANT NUMBER := 1;
DBMS_LCR.NULL_LONG         CONSTANT NUMBER := 2;
DBMS_LCR.INLINE_LONG       CONSTANT NUMBER := 3;
DBMS_LCR.LONG_CHUNK        CONSTANT NUMBER := 4;
DBMS_LCR.LAST_LONG_CHUNK   CONSTANT NUMBER := 5;

Returns NULL if the specified column does not exist.

If the command type of the row LCR is UPDATE, then specifying 'Y' for the use_old parameter is a convenient way to get the value of the columns.

Syntax
MEMBER FUNCTION GET_LONG_INFORMATION(
  value_type   IN  VARCHAR2,
  column_name  IN  VARCHAR2,
  use_old      IN  VARCHAR2  DEFAULT 'Y') 
RETURN NUMBER;
Parameters
Table 174-19 GET_LONG_INFORMATION Function Parameters
Parameter Description

value_type

The type of value to return for the column, either old or new

column_name

The name of the column

use_old

If Y and value_type is new, and no new value exists, then returns the corresponding old value. If N and value_type is new, then does not return the old value if no new value exists.

If value_type is old or if the command_type of the row LCR is not UPDATE, then the value of the use_old parameter is ignored.

NULL is not a valid specification for the use_old parameter.

GET_VALUE Member Function

Returns the old or new value for the specified column, depending on the value type specified.

If the command type of the row LCR is UPDATE, then specifying 'Y' for the use_old parameter is a convenient way to get the value of a column.

Syntax
MEMBER FUNCTION GET_VALUE(
   value_type   IN  VARCHAR2,
   column_name  IN  VARCHAR2,
   use_old      IN  VARCHAR2  DEFAULT 'Y') 
RETURN SYS.AnyData;
Parameters
Table 174-20 GET_VALUE Function Parameters
Parameter Description

value_type

The type of value to return for the column. Specify old to get the old value for the column. Specify new to get the new value for the column.

column_name

The column name. If the column is present and has a NULL value, returns a SYS.AnyData instance containing a NULL value. If the column value is absent, then returns a NULL.

use_old

If Y and value_type is new, and no new value exists, then returns the corresponding old value.

If N and value_type is new, then returns NULL if no new value exists.

If value_type is old or if the command_type of the row LCR is not UPDATE, then the value of the use_old parameter is ignored.

NULL is not a valid specification for the use_old parameter.

GET_VALUES Member Function

Returns a list of old or new values, depending on the value type specified.

If the command type of the row LCR is UPDATE, then specifying 'Y' for the use_old parameter is a convenient way to get the values of all columns.

Syntax
MEMBER FUNCTION GET_VALUES(
   value_type  IN  VARCHAR2,
   use_old     IN  VARCHAR2  DEFAULT 'Y')
RETURN SYS.LCR$_ROW_LIST;
Parameter
Table 174-21 GET_VALUES Procedure Parameter
Parameter Description

value_type

The type of values to return. Specify old to return a list of old values. Specify new to return a list of new values.

use_old

If Y and value_type is new, then returns a list of all new values in the LCR. If a new value does not exist in the list, then returns the corresponding old value. Therefore, the returned list contains all existing new values and old values for the new values that do not exist.

If N and value_type is new, then returns a list of all new values in the LCR without returning any old values.

If value_type is old or if the command_type of the row LCR is not UPDATE, then the value of the use_old parameter is ignored.

NULL is not a valid specification for the use_old parameter.

RENAME_COLUMN Member Procedure

Renames a column in an LCR.

Syntax
MEMBER PROCEDURE RENAME_COLUMN(
   from_column_name  IN  VARCHAR2,
   to_column_name    IN  VARCHAR2,
   value_type        IN  VARCHAR2  DEFAULT '*');
Parameters
Table 174-22 RENAME_COLUMN Procedure Parameters
Parameter Description

from_column_name

The existing column name

value_type

The type of value for which to rename the column.

Specify old to rename the old value of the column. An error is raised if the old value does not exist in the LCR.

Specify new to rename the new value of the column. An error is raised if the new value does not exist in the LCR.

If * is specified, then the column names for both old and new value are renamed. An error is raised if either column value does not exist in the LCR.

SET_LOB_INFORMATION Member Procedure

Sets LOB information for the column.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure.


Syntax
MEMBER PROCEDURE SET_LOB_INFORMATION(
  value_type       IN  VARCHAR2,
  column_name      IN  VARCHAR2,
  lob_information  IN  NUMBER);
Parameters
Table 174-23 SET_LOB_INFORMATION Procedure Parameters
Parameter Description

value_type

The type of value to set for the column, either old or new. Specify old only if lob_information is set to DBMS_LCR.NOT_A_LOB.

column_name

The name of the column. An exception is raised if the column value does not exist. You may need to set this parameter for non-LOB columns.

lob_information

Specify one of the following values:

  DBMS_LCR.NOT_A_LOB        CONSTANT NUMBER := 1;
  DBMS_LCR.NULL_LOB         CONSTANT NUMBER := 2;
  DBMS_LCR.INLINE_LOB       CONSTANT NUMBER := 3;
  DBMS_LCR.EMPTY_LOB        CONSTANT NUMBER := 4;
  DBMS_LCR.LOB_CHUNK        CONSTANT NUMBER := 5;
  DBMS_LCR.LAST_LOB_CHUNK   CONSTANT NUMBER := 6;

SET_LOB_OFFSET Member Procedure

Sets the LOB offset for the specified column in the number of characters for CLOB columns and the number of bytes for BLOB columns.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure.


Syntax
MEMBER PROCEDURE SET_LOB_OFFSET(
   value_type   IN  VARCHAR2,
   column_name  IN  VARCHAR2,
   lob_offset   IN  NUMBER);
Parameters
Table 174-24 SET_LOB_OFFSET Procedure Parameters
Parameter Description

value_type

The type of value to set for the column. Currently, only new can be specified.

column_name

The column name. An error is raised if the column value does not exist in the LCR.

SET_LOB_OPERATION_SIZE Member Procedure

Sets the operation size for the LOB column in the number of characters for CLOB columns and bytes for BLOB columns.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure.


Syntax
MEMBER PROCEDURE SET_LOB_OPERATION_SIZE(
  value_type          IN  VARCHAR2,
  column_name         IN  VARCHAR2,
  lob_operation_size  IN  NUMBER);
Parameters
Table 174-25 SET_LOB_OPERATION_SIZE Procedure Parameters
Parameter Description

value_type

The type of value to set for the column. Currently, only new can be specified.

column_name

The name of the LOB column. An exception is raised if the column value does not exist in the LCR.

lob_operation_size

If lob_information for the LOB is or will be DBMS_LCR.LAST_LOB_CHUNK, then can be set to either a valid LOB ERASE value or a valid LOB TRIM value. A LOB_ERASE value must be a positive integer less than or equal to DBMS_LOB.LOBMAXSIZE. A LOB_TRIM value must be a nonnegative integer less than or equal to DBMS_LOB.LOBMAXSIZE.

Otherwise, set to NULL.

SET_VALUE Member Procedure

Overwrites the old or new value of the specified column.

One reason you may want to overwrite an old value for a column is to resolve an error that resulted from a conflict.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure on a LONG, LONG RAW, or LOB column.


Syntax
MEMBER PROCEDURE SET_VALUE(
   value_type    IN  VARCHAR2,
   column_name   IN  VARCHAR2,
   column_value  IN  SYS.AnyData);
Parameters
Table 174-26 SET_VALUE Procedure Parameters
Parameter Description

value_type

The type of value to set. Specify old to set the old value of the column. Specify new to set the new value of the column.

column_name

The column name. An error is raised if the specified column_value does not exist in the LCR for the specified column_type.

column_value

The new value of the column. If NULL is specified, then an error is raised. To set the value to NULL, encapsulate the NULL in a SYS.AnyData instance.

SET_VALUES Member Procedure

Replaces all old values or all new values for the LCR, depending on the value type specified.


Note:

When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure on a LONG, LONG RAW, or LOB column.


Syntax
MEMBER PROCEDURE SET_VALUES(
   value_type  IN  VARCHAR2,
   value_list  IN  SYS.LCR$_ROW_LIST);
Parameters
Table 174-27 SET_VALUES Procedure Parameters
Parameter Description

value_type

The type of values to replace. Specify old to replace the old values. Specify new to replace the new values.

value_list

List of values to replace the existing list. Use a NULL or an empty list to remove all values.


Common Subprograms for LCR$_DDL_RECORD and LCR$_ROW_RECORD

The following functions and procedures are common to both the LCR$_DDL_RECORD and LCR$_ROW_RECORD type.

See Also:

For descriptions of the subprograms for these types that are exclusive to each type:

Table 174-28 Summary of Common Subprograms for DDL and Row LCR Types
Subprogram Description

"GET_COMMAND_TYPE Member Function"

Returns the command type of the LCR

"GET_COMMIT_SCN Member Function"

Returns the commit system change number (SCN) of the transaction to which the current LCR belongs

"GET_COMPATIBLE Member Function"

Returns the minimal database compatibility required to support the LCR

"GET_EXTRA_ATTRIBUTE Member Function"

Returns the value for the specified extra attribute in the LCR

"GET_OBJECT_NAME Member Function"

Returns the name of the object that is changed by the LCR

"GET_OBJECT_OWNER Member Function"

Returns the owner of the object that is changed by the LCR

"GET_SCN Member Function"

Returns the system change number (SCN) of the LCR

"GET_SOURCE_DATABASE_NAME Member Function"

Returns the source database name.

"GET_TAG Member Function"

Returns the tag for the LCR

"GET_TRANSACTION_ID Member Function"

Returns the transaction identifier of the LCR

"IS_NULL_TAG Member Function"

Returns Y if the tag for the LCR is NULL, or returns N if the tag for the LCR is not NULL

"SET_COMMAND_TYPE Member Procedure"

Sets the command type in the LCR

"SET_EXTRA_ATTRIBUTE Member Procedure"

Sets the value for the specified extra attribute in the LCR

"SET_OBJECT_NAME Member Procedure"

Sets the name of the object that is changed by the LCR

"SET_OBJECT_OWNER Member Procedure"

Sets the owner of the object that is changed by the LCR

"SET_SOURCE_DATABASE_NAME Member Procedure"

Sets the source database name of the object that is changed by the LCR

"SET_TAG Member Procedure"

Sets the tag for the LCR

GET_COMMAND_TYPE Member Function

Returns the command type of the LCR.

See Also:

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

Syntax
MEMBER FUNCTION GET_COMMAND_TYPE() 
RETURN VARCHAR2;

GET_COMMIT_SCN Member Function

Returns the commit system change number (SCN) of the transaction to which the current LCR belongs.

The commit SCN for a transaction is available only during apply or during error transaction execution. This function can be used only in a DML handler, DDL handler, or error handler. Such a handler may use the SCN obtained by this procedure to flashback to the transaction commit time for an LCR. In this case, the flashback must be performed at the source database for the LCR.

The commit SCN may not be available for an LCR that is part of an incomplete transaction. For example, user-enqueued LCRs may not have a commit SCN. If the commit SCN is not available for an LCR, then this function returns NULL.

Syntax
MEMBER FUNCTION GET_COMMIT_SCN() 
RETURN NUMBER;

GET_COMPATIBLE Member Function

Returns the minimal database compatibility required to support the LCR. You control the compatibility of an Oracle database using the COMPATIBLE initialization parameter.

The return value for this function can be one of the following:

Return Value COMPATIBLE Initialization Parameter Equivalent

DBMS_STREAMS.COMPATIBLE_9_2

9.2.0

DBMS_STREAMS.COMPATIBLE_10_1

10.0.0

DDL LCRs always return DBMS_STREAMS.COMPATIBLE_9_2.

You may use the following functions for constant compatibility return values:

You can use these functions with the GET_COMPATIBLE member function for an LCR in rule conditions and apply handlers.


Note:

You can determine which database objects in a database are not supported by Streams by querying the DBA_STREAMS_UNSUPPORTED data dictionary view.


See Also:
Syntax
MEMBER FUNCTION GET_COMPATIBLE() 
RETURN NUMBER;

GET_EXTRA_ATTRIBUTE Member Function

Returns the value for the specified extra attribute in the LCR. The returned extra attribute is contained within a SYS.AnyData instance. You can use the INCLUDE_EXTRA_ATTRIBUTE procedure in the DBMS_CAPTURE_ADM package to instruct a capture process to capture one or more extra attributes.

See Also:

"INCLUDE_EXTRA_ATTRIBUTE Procedure"

Syntax
MEMBER FUNCTION GET_EXTRA_ATTRIBUTE(
   attribute_name  IN  VARCHAR2) 
RETURN SYS.AnyData;
Parameters
Table 174-29 GET_EXTRA_ATTRIBUTE Function Parameter
Parameter Description

attribute_name

The name of the extra attribute to return. Valid names are:

  • row_id

    The rowid of the row changed in a row LCR. This attribute is not included in DDL LCRs, nor in row LCRs for index-organized tables. The type is UROWID.

  • serial#

    The serial number of the session that performed the change captured in the LCR. The type is NUMBER.

  • session#

    The identifier of the session that performed the change captured in the LCR. The type is NUMBER.

  • thread#

    The thread number of the instance in which the change captured in the LCR was performed. Typically, the thread number is relevant only in a Real Application Clusters environment. The type is NUMBER.

  • tx_name

    The name of the transaction that includes the LCR. The type is VARCHAR2.

  • username

    The name of the user who performed the change captured in the LCR. The type is VARCHAR2.

An error is raised if the specified attribute_name is not valid.

If no value exists for the specified extra attribute, then returns a NULL.

GET_OBJECT_NAME Member Function

Returns the name of the object that is changed by the LCR.

Syntax
MEMBER FUNCTION GET_OBJECT_NAME()
RETURN VARCHAR2;

GET_OBJECT_OWNER Member Function

Returns the owner of the object that is changed by the LCR.

Syntax
MEMBER FUNCTION GET_OBJECT_OWNER() 
RETURN VARCHAR2;

GET_SCN Member Function

Returns the system change number (SCN) of the LCR.

Syntax
MEMBER FUNCTION GET_SCN() 
RETURN NUMBER;

GET_SOURCE_DATABASE_NAME Member Function

Returns the global name of the source database name. The source database is the database where the change occurred.

Syntax
MEMBER FUNCTION GET_SOURCE_DATABASE_NAME() 
RETURN VARCHAR2;

GET_TAG Member Function

Returns the tag for the LCR. An LCR tag is a binary tag that enables tracking of the LCR. For example, this tag may be used to determine the original source database of the DML or DDL change when apply forwarding is used.

See Also:

Oracle Streams Replication Administrator's Guide for more information about tags

Syntax
MEMBER FUNCTION GET_TAG() 
RETURN RAW;

GET_TRANSACTION_ID Member Function

Returns the transaction identifier of the LCR.

Syntax
MEMBER FUNCTION GET_TRANSACTION_ID() 
RETURN VARCHAR2;

IS_NULL_TAG Member Function

Returns Y if the tag for the LCR is NULL, or returns N if the tag for the LCR is not NULL.

See Also:

Oracle Streams Replication Administrator's Guide for more information about tags

Syntax
MEMBER FUNCTION IS_NULL_TAG() 
RETURN VARCHAR2;

SET_COMMAND_TYPE Member Procedure

Sets the command type in the LCR. If the command type specified cannot be interpreted, then an error is raised. For example, changing INSERT to GRANT would raise an error.

See Also:
Syntax
MEMBER PROCEDURE SET_COMMAND_TYPE(
   command_type  IN  VARCHAR2);
Parameter
Table 174-30 SET_COMMAND_TYPE Procedure Parameter
Parameter Description

command_type

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

SET_EXTRA_ATTRIBUTE Member Procedure

Sets the value for the specified extra attribute in the LCR. You can use the INCLUDE_EXTRA_ATTRIBUTE procedure in the DBMS_CAPTURE_ADM package to instruct a capture process to capture one or more extra attributes.

See Also:

"INCLUDE_EXTRA_ATTRIBUTE Procedure"

Syntax
MEMBER PROCEDURE SET_EXTRA_ATTRIBUTE(
   attribute_name   IN  VARCHAR2,
   attribute_value  IN  SYS.AnyData);
Parameters
Table 174-31 SET_EXTRA_ATTRIBUTE Procedure Parameter
Parameter Description

attribute_name

The name of the extra attribute to set. Valid names are:

  • row_id

    The rowid of the row changed in a row LCR. This attribute is not included in DDL LCRs, nor in row LCRs for index-organized tables. The type is VARCHAR2.

  • serial#

    The serial number of the session that performed the change captured in the LCR. The type is NUMBER.

  • session#

    The identifier of the session that performed the change captured in the LCR. The type is NUMBER.

  • thread#

    The thread number of the instance in which the change captured in the LCR was performed. Typically, the thread number is relevant only in a Real Application Clusters environment. The type is NUMBER.

  • tx_name

    The name of the transaction that includes the LCR. The type is VARCHAR2.

  • username

    The name of the user who performed the change captured in the LCR. The type is VARCHAR2.

An error is raised if the specified attribute_name is not valid.

attribute_value

The value to which the specified extra attribute is set. If set to NULL, then the specified extra attribute is removed from the LCR. To set to NULL, encapsulate the NULL in a SYS.AnyData instance.

SET_OBJECT_NAME Member Procedure

Sets the name of the object that is changed by the LCR.

Syntax
MEMBER PROCEDURE SET_OBJECT_NAME(
   object_name  IN  VARCHAR2);
Parameter
Table 174-32 SET_OBJECT_NAME Procedure Parameter
Parameter Description

object_name

The name of the object

SET_OBJECT_OWNER Member Procedure

Sets the owner of the object that is changed by the LCR.

Syntax
MEMBER PROCEDURE SET_OBJECT_OWNER(
   object_owner  IN  VARCHAR2);
Parameter
Table 174-33 SET_OBJECT_OWNER Procedure Parameter
Parameter Description

object_owner

The schema that contains the object

SET_SOURCE_DATABASE_NAME Member Procedure

Sets the source database name of the object that is changed by the LCR.

Syntax
MEMBER PROCEDURE SET_SOURCE_DATABASE_NAME(
   source_database_name  IN  VARCHAR2);
Parameter
Table 174-34 SET_SOURCE_DATABASE_NAME Procedure Parameter
Parameter Description

source_database_name

The source database of the change. 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.

SET_TAG Member Procedure

Sets the tag for the LCR. An LCR tag is a binary tag that enables tracking of the LCR. For example, this tag may be used to determine the original source database of the change when apply forwarding is used.

See Also:

Oracle Streams Replication Administrator's Guide for more information about tags

Syntax
MEMBER PROCEDURE SET_TAG(
   tag  IN  RAW);
Parameter
Table 174-35 SET_TAG Procedure Parameter
Parameter Description

tag

The binary tag for the LCR. The size limit for a tag value is two kilobytes.


LCR$_ROW_LIST Type

Identifies a list of column values for a row in a table.

This type uses the LCR$_ROW_UNIT type and is used in the LCR$_ROW_RECORD type.

See Also:

Syntax

CREATE TYPE SYS.LCR$_ROW_LIST AS TABLE OF SYS.LCR$_ROW_UNIT
/


LCR$_ROW_UNIT Type

Identifies the value for a column in a row.

This type is used in the LCR$_ROW_LIST type.

See Also:

"LCR$_ROW_LIST Type"

Syntax

CREATE TYPE LCR$_ROW_UNIT AS OBJECT (
  column_name         VARCHAR2(4000),
  data                SYS.AnyData,
  lob_information     NUMBER,
  lob_offset          NUMBER,
  lob_operation_size  NUMBER
  long_information    NUMBER);
/

Attributes

Table 174-36  LCR$_ROW_UNIT Attributes
Attribute Description

column_name

The name of the column

data

The data contained in the column

lob_information

Contains the LOB information for the column and contains one of the following values:

  DBMS_LCR.NOT_A_LOB        CONSTANT NUMBER := 1;
  DBMS_LCR.NULL_LOB         CONSTANT NUMBER := 2;
  DBMS_LCR.INLINE_LOB       CONSTANT NUMBER := 3;
  DBMS_LCR.EMPTY_LOB        CONSTANT NUMBER := 4;
  DBMS_LCR.LOB_CHUNK        CONSTANT NUMBER := 5;
  DBMS_LCR.LAST_LOB_CHUNK   CONSTANT NUMBER := 6;

lob_offset

The LOB offset specified in the number of characters for CLOB columns and the number of bytes for BLOB columns. Valid values are NULL or a positive integer less than or equal to DBMS_LOB.LOBMAXSIZE.

lob_operation_size

If lob_information for the LOB is DBMS_LCR.LAST_LOB_CHUNK, then can be set to either a valid LOB ERASE value or a valid LOB TRIM value. A LOB_ERASE value must be a positive integer less than or equal to DBMS_LOB.LOBMAXSIZE. A LOB_TRIM value must be a nonnegative integer less than or equal to DBMS_LOB.LOBMAXSIZE.

If lob_information is not DBMS_LCR.LAST_LOB_CHUNK and for all other operations, is NULL.

long_information

Contains the LONG information for the column and contains one of the following values:

DBMS_LCR.not_a_long CONSTANT NUMBER := 1;

DBMS_LCR.null_long CONSTANT NUMBER := 2;

DBMS_LCR.inline_long CONSTANT NUMBER := 3;

DBMS_LCR.long_chunk CONSTANT NUMBER := 4;

DBMS_LCR.last_long_chunk CONSTANT NUMBER := 5;