Oracle® Database PL/SQL Packages and Types Reference 10g Release 2 (10.2) Part Number B14258-02 |
|
|
View PDF |
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 LCRsThis chapter contains these topics:
Table 189-1 Logical Change Record (LCR) Types
Type | Description |
---|---|
Represents a data definition language (DDL) change to a database object |
|
Represents a data manipulation language (DML) change to a database object |
|
Identifies a list of column values for a row in a table |
|
Identifies the value for a column in a row |
These logical change record (LCR) types can be used with the following Oracle-supplied PL/SQL packages:
DBMS_APPLY_ADM
DBMS_AQ
DBMS_AQADM
DBMS_CAPTURE_ADM
DBMS_PROPAGATION_ADM
DBMS_RULE
DBMS_RULE_ADM
DBMS_STREAMS
DBMS_STREAMS_ADM
DBMS_TRANSFORM
This type represents a data definition language (DDL) change to a database object.
If you create or modify a DDL logical change record (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:
Summary of LCR$_DDL_RECORD Subprograms, which also include the subprograms described in "Common Subprograms for LCR$_DDL_RECORD and LCR$_ROW_RECORD"
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.
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 189-2 Constructor Function Parameters for LCR$_DDL_RECORD
Parameter | Description |
---|---|
|
The database where the DDL statement occurred. If you do not include the domain name, then the function appends the local domain to the database name automatically. For example, if you specify |
|
The type of command executed in the DDL statement. This parameter should be set to a non- 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. |
|
The user who owns the object on which the DDL statement was executed |
|
The database object on which the DDL statement was executed |
|
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
|
|
The text of the DDL statement. This parameter should be set to a non- |
|
The user whose session executed the DDL statement |
|
The schema that is used if no schema is specified explicitly for the modified database objects in This parameter should be set to a non- |
|
If the DDL statement is a table related DDL (such as |
|
If the DDL statement is a table related DDL (such as |
|
A binary tag that enables tracking of the LCR. For example, this tag can 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 |
|
The identifier of the transaction |
|
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. |
Table 189-3 LCR$_DDL_RECORD Type Subprograms
Subprogram | Description |
---|---|
Executes the LCR under the security domain of the current user |
|
Returns the base (dependent) table name |
|
Returns the base (dependent) table owner |
|
Returns the default schema (user) name |
|
Gets the DDL text in a |
|
Returns the logon user name |
|
Returns the type of the object involved for the DDL |
|
Sets the base (dependent) table name |
|
Sets the base (dependent) table owner |
|
Sets the default schema (user) name |
|
Sets the DDL text |
|
Sets the logon user name |
|
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 |
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:
TheEXECUTE
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 189-4 GET_DDL_TEXT Procedure Parameter
Parameter | Description |
---|---|
|
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 189-5 SET_BASE_TABLE_NAME Procedure Parameter
Parameter | Description |
---|---|
|
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 189-6 SET_BASE_TABLE_OWNER Procedure Parameter
Parameter | Description |
---|---|
|
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 189-7 SET_CURRENT_SCHEMA Procedure Parameter
Parameter | Description |
---|---|
|
The name of the schema to set as the current schema. This parameter should be set to a non- |
Sets the DDL text.
Syntax
MEMBER PROCEDURE SET_DDL_TEXT( ddl_text IN CLOB);
Parameter
Table 189-8 SET_DDL_TEXT Procedure Parameter
Parameter | Description |
---|---|
|
The DDL text. This parameter should be set to a non- |
SET_LOGON_USER Member Procedure
Sets the logon user name.
Syntax
MEMBER PROCEDURE SET_LOGON_USER( logon_user IN VARCHAR2);
Parameter
Table 189-9 SET_LOGON_USER Procedure Parameter
Parameter | Description |
---|---|
|
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 189-10 SET_OBJECT_TYPE Procedure Parameter
Parameter | Description |
---|---|
|
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
|
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 logical change record (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:
Summary of LCR$_ROW_RECORD Subprograms, which also include the subprograms described in Common Subprograms for LCR$_DDL_RECORD and LCR$_ROW_RECORD
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.
See Also:
"LCR$_ROW_LIST Type"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 189-11 Constructor Function Parameters for LCR$_ROW_RECORD
Parameter | Description |
---|---|
|
The database where the row change occurred. If you do not include the domain name, then the function appends the local domain to the database name automatically. For example, if you specify |
|
The type of command executed in the DML statement. This parameter should be set to a non- Valid values are the following: INSERT UPDATE DELETE LOB ERASE LOB WRITE LOB TRIM If If If If |
|
The user who owns the table on which the row change occurred. This parameter should be set to a non- |
|
The table on which the DML statement was executed. This parameter should be set to a non- |
|
A binary tag that enables tracking of the LCR. For example, this tag can 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 |
|
The identifier of the transaction |
|
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. |
|
The column values for the row before the DML change. If the DML statement is an |
|
The column values for the row after the DML change. If the DML statement is an If the LCR reflects a LOB operation, then this parameter contains the supplementally logged columns and any relevant LOB information. |
Table 189-12 LCR$_ROW_RECORD Type Subprograms
Subprogram | Description |
---|---|
Adds the value as old or new, depending on the value type specified, for the column |
|
Converts |
|
Deletes the old value, the new value, or both, for the specified column, depending on the value type specified |
|
Executes the LCR under the security domain of the current user |
|
Gets the LOB information for the column |
|
Returns the LOB offset for the specified column |
|
Gets the operation size for the |
|
Gets the |
|
Returns the old or new value for the specified column, depending on the value type specified |
|
Returns a list of old or new values, depending on the value type specified |
|
Renames a column in an LCR |
|
Sets LOB information for the column |
|
Sets the LOB offset for the specified column |
|
Sets the operation size for the LOB column |
|
Overwrites the value of the specified column |
|
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 |
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.
Note:
To set a column value that already exists, runSET_VALUE
.See Also:
"SET_VALUE Member Procedure"Considerations for LOB Columns
When processing a row LCR with LOB columns with a DML handler or error handler and the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), you use this member procedure in the handler procedure to add a LOB column to a row LCR. If assemble_lobs
is set to FALSE
for the handler, then you cannot use this member procedure to add a LOB column to a row LCR.
To use a DML or error handler to add a LOB column, specify the LOB locator for the column_value
parameter in the member procedure. The ADD_COLUMN
member procedure verifies that a ANYDATA
encapsulated LOB locator is processed with a DML or error handler that is using LOB assembly. An error is raised under the following conditions:
The handler attempts to enqueue a row LCR with a ANYDATA
encapsulated LOB locator.
An attempt is made to add an LOB column that is set incorrectly.
If an error is raised because of one of these conditions, then the transaction that includes the row LCR is moved to the error queue, and the LOB is represented by the original (nonassembled) row LCRs.
Note:
Database compatibility must be 10.2.0
or higher to use LOB assembly.
When you are processing a row LCR with a rule-based transformation, you cannot use this member procedure to add a LOB column.
When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure to add a LONG
or LONG
RAW
column.
Syntax
MEMBER PROCEDURE ADD_COLUMN( value_type IN VARCHAR2, column_name IN VARCHAR2, column_value IN ANYDATA);
Parameters
Table 189-13 ADD_COLUMN Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to add for the column. Specify |
|
The column name. This name is not validated. An error can be raised during application of the LCRs if an invalid name is specified. |
|
The value of the column. If If the member procedure is used in a DML handler or error handler that uses LOB assembly, then a LOB locator can be specified. A |
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 can change the operation code from LONG
WRITE
to LOB
WRITE
for the row LCR.
This member procedure can be used in rule-based transformations.
The following restrictions apply to this member procedure:
This member procedure cannot be used in apply handlers.
LONG
data can be sent as a part of a row LCR with one of the following operation codes: INSERT
, UPDATE
, or LONG_WRITE
. Because LONG
data can be sent in multiple pieces, make sure that this method is invoked on either none or all LONG
pieces.
LOB to LONG
conversion is not supported.
A row LCR on which this procedure is executed must have been created by a capture process. That is, this procedure does not support user-enqueued row LCRs.
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 189-14 DELETE_COLUMN Procedure Parameters
Parameter | Description |
---|---|
|
The column name. An error is raised if the column does not exist in the LCR. |
|
The type of value to delete for the column. Specify |
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.
This member procedure can be run on a row LCR under any of the following conditions:
The LCR is being processed by an apply handler.
The LCR is in a queue and was last enqueued by an apply process, an application, or a user.
The LCR has been constructed using the LCR$_ROW_RECORD
constructor function but has not been enqueued.
The LCR is in the error queue.
Note:
A custom rule-based transformation should not run this member procedure on a row LCR. Doing so could execute the row LCR outside of its transactional context.Considerations for LOB Columns
When processing a row LCR with LOB columns with a DML handler or error handler, and the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), this member procedure executes the assembled row LCR. An assembled row LCR represents a LOB value with a LOB locator or NULL
.
If assemble_lobs
is set to FALSE
for the handler, then this member procedure executes the nonassembled row LCRs. Nonassembled row LCRs represent LOB values with VARCHAR2
and RAW
datatypes. These nonassembled row LCRs might have been modified by the handler.
An error is raised under the following conditions:
A DML or error handler configured with assemble_lobs
set to FALSE
attempts to execute a row LCR that contains a LOB locator.
A DML or error handler configured with assemble_lobs
set to TRUE
attempts to execute a row LCR that contains one or more LOB values represented with VARCHAR2
or RAW
datatypes.
If an error is raised because of one of these conditions, then the transaction that includes the row LCR is moved to the error queue, and the LOB is represented by the original (nonassembled) row LCRs.
Syntax
MEMBER PROCEDURE EXECUTE( conflict_resolution IN BOOLEAN);
Parameters
Table 189-15 EXECUTE Procedure Parameters
Parameter | Description |
---|---|
|
If If An error is raised if this parameter is not specified or is set to |
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 189-16 GET_LOB_INFORMATION Function Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column, either |
|
The name of the column |
|
If If
|
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:
The value exists for the column
The column value is an out-of-line LOB. That is, the information is DBMS_LCR.LAST_LOB_CHUNK
or DBMS_LCR.LOB_CHUNK
The command type is LOB
ERASE
or LOB
WRITE
Otherwise, returns NULL
.
Syntax
GET_LOB_OFFSET( value_type IN VARCHAR2, column_name IN VARCHAR2) RETURN NUMBER;
Parameters
Table 189-17 GET_LOB_OFFSET Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column. Currently, only |
|
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:
The value exists for the column
The column value is an out-of-line LOB
The command type is LOB
ERASE
or LOB
TRIM
The information is DBMS_LCR.LAST_LOB_CHUNK
Otherwise, returns NULL
.
Syntax
MEMBER FUNCTION GET_LOB_OPERATION_SIZE( value_type IN VARCHAR2, column_name IN VARCHAR2) RETURN NUMBER,
Parameters
Table 189-18 GET_LOB_OPERATION_SIZE Function Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column. Currently, only |
|
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 189-19 GET_LONG_INFORMATION Function Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column, either |
|
The name of the column |
|
If If
|
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 ANYDATA;
Parameters
Table 189-20 GET_VALUE Function Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column. Specify |
|
The column name. If the column is present and has a |
|
If If If
|
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 189-21 GET_VALUES Function Parameter
Parameter | Description |
---|---|
|
The type of values to return. Specify |
|
If If If
|
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 189-22 RENAME_COLUMN Procedure Parameters
Parameter | Description |
---|---|
|
The existing column name |
|
The new column name. An error is raised if a column with the specified name already exists. |
|
The type of value for which to rename the column. Specify Specify If |
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 189-23 SET_LOB_INFORMATION Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to set for the column, either |
|
The name of the column. An exception is raised if the column value does not exist. You might need to set this parameter for non-LOB columns. |
|
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 189-24 SET_LOB_OFFSET Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to set for the column. Currently, only |
|
The column name. An error is raised if the column value does not exist in the LCR. |
|
The LOB offset number. Valid values are |
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 189-25 SET_LOB_OPERATION_SIZE Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to set for the column. Currently, only |
|
The name of the LOB column. An exception is raised if the column value does not exist in the LCR. |
|
If Otherwise, set to |
Overwrites the old or new value of the specified column.
One reason to overwrite an old value for a column is to resolve an error that resulted from a conflict.
Note:
To add a column to a row LCR, runADD_COLUMN
.See Also:
"ADD_COLUMN Member Procedure"Considerations for LOB Columns
When processing a row LCR with LOB columns with a DML handler or error handler and the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), you use this member procedure in the handler procedure on a LOB column in a row LCR. If assemble_lobs
is set to FALSE
for the handler, then you cannot use this member procedure on a LOB column.
To use a DML or error handler to set the value of a LOB column, specify the LOB locator for the column_value
parameter in the member procedure. The SET_VALUE
member procedure verifies that a ANYDATA
encapsulated LOB locator is processed with a DML or error handler that is using LOB assembly. An error is raised under the following conditions:
The handler attempts to enqueue a row LCR with a ANYDATA
encapsulated LOB locator.
An attempt is made to set a LOB column incorrectly.
If an error is raised because of one of these conditions, then the transaction that includes the row LCR is moved to the error queue, and the LOB is represented by the original (nonassembled) row LCRs.
Note:
Database compatibility must be 10.2.0
or higher to use LOB assembly.
When you are processing a row LCR with a rule-based transformation, you cannot use this member procedure on a LOB column.
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
or LONG
RAW
column.
Syntax
MEMBER PROCEDURE SET_VALUE( value_type IN VARCHAR2, column_name IN VARCHAR2, column_value IN ANYDATA);
Parameters
Table 189-26 SET_VALUE Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to set. Specify |
|
The column name. An error is raised if the specified |
|
The new value of the column. If If the member procedure is used in a DML handler or error handler that uses LOB assembly, then specify a LOB locator. |
Replaces all old values or all new values for the LCR, depending on the value type specified.
Considerations for LOB Columns
When processing a row LCR with LOB columns with a DML handler or error handler and the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), you use this member procedure in the handler procedure on a row LCR that contains one or more LOB columns. If assemble_lobs
is set to FALSE
for the handler, then you cannot use this member procedure on a row LCR.
To use a DML or error handler to set the value of one or more LOB columns in a row LCR, specify a LOB locator for each LOB column in the value_list
parameter. The SET_VALUES
member procedure verifies that a ANYDATA
encapsulated LOB locator is processed with a DML or error handler that is using LOB assembly. An error is raised under the following conditions:
The handler attempts to enqueue a row LCR with a ANYDATA
encapsulated LOB locator.
An attempt is made to set a LOB column incorrectly.
If an error is raised because of one of these conditions, then the transaction that includes the row LCR is moved to the error queue, and the LOB columns are represented by the original (nonassembled) row LCRs.
Note:
Database compatibility must be 10.2.0
or higher to use LOB assembly.
When you are processing a row LCR with a rule-based transformation, you cannot use this member procedure on LOB columns.
When you are processing a row LCR with a rule-based transformation, DML handler, or error handler, you cannot use this member procedure on LONG
or LONG
RAW
columns.
Syntax
MEMBER PROCEDURE SET_VALUES( value_type IN VARCHAR2, value_list IN SYS.LCR$_ROW_LIST);
Parameters
Table 189-27 SET_VALUES Procedure Parameters
Parameter | Description |
---|---|
|
The type of values to replace. Specify |
|
List of values to replace the existing list. Use a If the member procedure is used in a DML handler or error handler that uses LOB assembly, then specify one or more LOB locators. |
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 189-28 Summary of Common Subprograms for DDL and Row LCR Types
Subprogram | Description |
---|---|
Returns the command type of the logical change record (LCR) |
|
Returns the commit system change number (SCN) of the transaction to which the current LCR belongs |
|
Returns the minimal database compatibility required to support the LCR |
|
Returns the value for the specified extra attribute in the LCR |
|
Returns the name of the object that is changed by the LCR |
|
Returns the owner of the object that is changed by the LCR |
|
Returns the system change number (SCN) of the LCR |
|
Returns the source database name. |
|
Returns the time when the change in an LCR captured by a capture process was generated in the redo log of the source database, or the time when a user-enqueued LCR was created. |
|
Returns the tag for the LCR |
|
Returns the transaction identifier of the LCR |
|
Returns |
|
Sets the command type in the LCR |
|
Sets the value for the specified extra attribute in the LCR |
|
Sets the name of the object that is changed by the LCR |
|
Sets the owner of the object that is changed by the LCR |
|
Sets the source database name of the object that is changed by the LCR |
|
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 typesSyntax
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 can 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 might not be available for an LCR that is part of an incomplete transaction. For example, user-enqueued LCRs might 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.1.0 |
DBMS_STREAMS.COMPATIBLE_10_2 |
10.2.0 |
DDL LCRs always return DBMS_STREAMS.COMPATIBLE_9_2
.
You can use the following functions for constant compatibility return values:
The DBMS_STREAMS.COMPATIBLE_9_2
function returns the DBMS_STREAMS.COMPATIBLE_9_2
constant.
The DBMS_STREAMS.COMPATIBLE_10_1
function returns DBMS_STREAMS.COMPATIBLE_10_1
constant.
The DBMS_STREAMS.COMPATIBLE_10_2
function returns DBMS_STREAMS.COMPATIBLE_10_2
constant.
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 theDBA_STREAMS_UNSUPPORTED
data dictionary view.See Also:
Oracle Streams Concepts and Administration for examples of rules that discard changes that are not supported by Streams
Chapter 105, "DBMS_STREAMS" and Chapter 106, "DBMS_STREAMS_ADM"
Oracle Database Reference and Oracle Database Upgrade Guide for more information about the COMPATIBLE
initialization parameter
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 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 ANYDATA;
Parameters
Table 189-29 GET_EXTRA_ATTRIBUTE Function Parameter
Parameter | Description |
---|---|
|
The name of the extra attribute to return. Valid names are:
An error is raised if the specified If no value exists for the specified extra attribute, then the function returns a See Also: Oracle Database PL/SQL User's Guide and Reference for more information about the current user |
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;
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_SOURCE_TIME Member Function
Returns the time when the change in an LCR captured by a capture process was generated in the redo log of the source database, or the time when a user-enqueued LCR was created.
Syntax
MEMBER FUNCTION GET_SOURCE_TIME() RETURN DATE;
Returns the tag for the LCR. An LCR tag is a binary tag that enables tracking of the LCR. For example, this tag can 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 tagsSyntax
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;
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 tagsSyntax
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 this procedure raises an error. For example, changing INSERT
to GRANT
would raise an error.
See Also:
The description of the command_type
parameter in "LCR$_DDL_RECORD Constructor Function Parameters"
The description of the command_type parameter in "LCR$_ROW_RECORD Type"
The "SQL Command Codes" table in the Oracle Call Interface Programmer's Guide for a complete list of command types
Syntax
MEMBER PROCEDURE SET_COMMAND_TYPE( command_type IN VARCHAR2);
Parameter
Table 189-30 SET_COMMAND_TYPE Procedure Parameter
Parameter | Description |
---|---|
|
The command type. This parameter should be set to a non- |
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 ANYDATA);
Parameters
Table 189-31 SET_EXTRA_ATTRIBUTE Procedure Parameter
Parameter | Description |
---|---|
|
The name of the extra attribute to set. Valid names are:
An error is raised if the specified See Also: Oracle Database PL/SQL User's Guide and Reference for more information about the current user |
|
The value to which the specified extra attribute is set. If set to |
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 189-32 SET_OBJECT_NAME Procedure Parameter
Parameter | Description |
---|---|
|
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 189-33 SET_OBJECT_OWNER Procedure Parameter
Parameter | Description |
---|---|
|
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 189-34 SET_SOURCE_DATABASE_NAME Procedure Parameter
Parameter | Description |
---|---|
|
The source database of the change. If you do not include the domain name, then the procedure appends the local domain to the database name automatically. For example, if you specify |
Sets the tag for the LCR. An LCR tag is a binary tag that enables tracking of the LCR. For example, this tag can 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 tagsSyntax
MEMBER PROCEDURE SET_TAG( tag IN RAW);
Parameter
Table 189-35 SET_TAG Procedure Parameter
Parameter | Description |
---|---|
|
The binary tag for the LCR. The size limit for a tag value is two kilobytes. |
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 /
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 ANYDATA, lob_information NUMBER, lob_offset NUMBER, lob_operation_size NUMBER long_information NUMBER); /
Attributes
Table 189-36 LCR$_ROW_UNIT Attributes
Attribute | Description |
---|---|
|
The name of the column |
|
The data contained in the column |
|
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; |
|
The LOB offset specified in the number of characters for |
|
If If |
|
Contains the
|