This chapter describes the logical change record (LCR) types.
This chapter contains these topics:
Using Logical Change Record Types
Overview
Security Model
This section contains topics that relate to using the logical change record (LCR) types.
In Oracle Streams, logical change records (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 Oracle 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 LCRsTable 275-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 row 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, position IN RAW DEFAULT NULL, edition_name IN VARCHAR2 DEFAULT NULL, root_name IN VARCHAR2 DEFAULT NULL) RETURN SYS.LCR$_DDL_RECORD;
LCR$_DDL_RECORD Constructor Function Parameters
Table 275-2 Constructor Function Parameters for LCR$_DDL_RECORD
Parameter | Description |
---|---|
|
The database where the DDL statement occurred If the LCRs originated in a multitenant container database (CDB), then this field specifies the global name of the container where the DDL 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 DDL statement Set this parameter 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 Set this parameter 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 If a schema is specified in Set this parameter 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. |
|
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. |
|
The position of the LCR LCR position is commonly used in XStream configurations. Using XStream requires purchasing a license for the Oracle GoldenGate product. See Also: Oracle Database XStream Guide |
|
The name of the edition in which the DDL statement was executed |
|
If the LCRs is associated with a CDB, then this field specifies the global name of the root in the CDB. If the LCR is associated with a non-CDB, then this field is |
Table 275-3 LCR$_DDL_RECORD Type Subprograms
Subprogram | Description |
---|---|
Executes the LCR under the security domain of the current user |
|
Gets the base (dependent) table name |
|
Gets the base (dependent) table owner |
|
Gets the default schema (user) name |
|
Gets the DDL text in a |
|
Gets the name of the edition in which the DDL statement was executed |
|
Gets the logon user name |
|
Gets 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 name of the edition in which the DDL statement was executed |
|
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. Apply handlers 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 Oracle Streams apply process.Gets the DDL text in a CLOB
.
For example, the following PL/SQL code 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.GET_EDITION_NAME Member Function
Gets the name of the edition in which the DDL statement was executed.
See Also:
Oracle Database Development GuideSET_EDITION_NAME Member Procedure
Sets the name of the edition in which the DDL statement was executed.
See Also:
Oracle Database Development GuideTable 275-11 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 TypeCreates 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, position IN RAW DEFAULT NULL, root_name IN VARCHAR2 DEFAULT NULL) RETURN SYS.LCR$_ROW_RECORD;
LCR$_ROW_RECORD Constructor Function Parameters
Table 275-12 Constructor Function Parameters for LCR$_ROW_RECORD
Parameter | Description |
---|---|
|
The database where the row change occurred If the LCRs originated in a CDB, then this field specifies the global name of the container 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 Set this parameter 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 Set this parameter to a non- |
|
The table on which the DML statement was executed Set this parameter 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. |
|
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. |
|
The position of the LCR LCR position is commonly used in XStream configurations. Using XStream requires purchasing a license for the Oracle GoldenGate product. See Also: Oracle Database XStream Guide |
|
If the LCRs is associated with a CDB, then this field specifies the global name of the root in the CDB. If the LCR is associated with a non-CDB, then this field is |
Table 275-13 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 |
|
Gets the LOB offset for the specified column |
|
Gets the operation size for the |
|
Gets the |
|
Gets the SQL statement for the change that is encapsulated in the LCR |
|
Gets the old or new value for the specified column, depending on the value type specified |
|
Gets a list of old or new values, depending on the value type specified |
|
Gets a |
|
Gets the XML information for the specified column |
|
Keeps a list of columns a row LCR |
|
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 |
|
Sets the XML information for the column |
|
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 ProcedureConsiderations for LOB Columns
When processing a row LCR with LOB columns with a procedure 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 an 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 an 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, procedure DML handler, or error handler, you cannot use this member procedure to add a LONG
or LONG
RAW
column.
MEMBER PROCEDURE ADD_COLUMN( value_type IN VARCHAR2, column_name IN VARCHAR2, column_value IN ANYDATA);
Table 275-14 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 procedure 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 persistent row LCRs.
DELETE_COLUMN Member Procedure
Deletes the old value, the new value, or both, for the specified column, depending on the value type specified.
MEMBER PROCEDURE DELETE_COLUMN( column_name IN VARCHAR2, value_type IN VARCHAR2 DEFAULT '*');
Table 275-15 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 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 a mechanism other than an Oracle Streams capture process, such as an Oracle Streams apply process or an application.
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:
Do not run this member procedure in a custom rule-based transformation 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 procedure 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
data types. 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
data types.
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.
Table 275-16 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.
MEMBER FUNCTION GET_LOB_INFORMATION( value_type IN VARCHAR2, column_name IN VARCHAR2, use_old IN VARCHAR2 DEFAULT 'Y') RETURN NUMBER;
Table 275-17 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
.
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
.
MEMBER FUNCTION GET_LOB_OPERATION_SIZE( value_type IN VARCHAR2, column_name IN VARCHAR2) RETURN NUMBER,
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.
MEMBER FUNCTION GET_LONG_INFORMATION( value_type IN VARCHAR2, column_name IN VARCHAR2, use_old IN VARCHAR2 DEFAULT 'Y') RETURN NUMBER;
Table 275-20 GET_LONG_INFORMATION Function Parameters
Parameter | Description |
---|---|
|
The type of value to return for the column, either |
|
The name of the column |
|
If If
|
Gets the SQL statement for the change that is encapsulated in the row LCR. This method performs SQL generation in PL/SQL.
This method is overloaded. The different functionality of each form of syntax is presented along with the definitions.
The following procedure returns the SQL statement in a CLOB
datatype.
MEMBER PROCEDURE GET_ROW_TEXT( row_text IN/OUT CLOB);
The following procedure returns the SQL statement with bind variables in a CLOB
datatype.
MEMBER PROCEDURE GET_ROW_TEXT( row_text IN/OUT CLOB, variable_list IN/OUT LCR$_ROW_LIST, bind_var_syntax IN VARCHAR2 DEFAULT ':');
See Also:
"LCR$_ROW_LIST Type"Table 275-21 GET_ROW_TEXT Procedure Parameters
Parameter | Description |
---|---|
|
The SQL statement for the change that is encapsulated in the LCR |
|
The values for the bind variables in the order of the bind variables |
|
The syntax for the bind variables One of the following values is valid:
|
Gets 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.
MEMBER FUNCTION GET_VALUE( value_type IN VARCHAR2, column_name IN VARCHAR2, use_old IN VARCHAR2 DEFAULT 'Y') RETURN ANYDATA;
Table 275-22 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
|
Gets 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.
MEMBER FUNCTION GET_VALUES( value_type IN VARCHAR2, use_old IN VARCHAR2 DEFAULT 'Y') RETURN SYS.LCR$_ROW_LIST;
Table 275-23 GET_VALUES Function Parameters
Parameter | Description |
---|---|
|
The type of values to return Specify |
|
If If If
|
GET_WHERE_CLAUSE Member Procedure
Gets a WHERE
clause for the change that is encapsulated in the row LCR.
Use the WHERE
clause returned by GET_WHERE_CLAUSE
instead of using the ROWID
, because the ROWID
is not ANSI compatible. The generated WHERE
clause might not match the WHERE
clause in the original DML operation.
The ROWID
of an INSERT
statement is the ROWID
of the new row created by the INSERT
. The WHERE
clause generated for an INSERT
operation identifies the new row. Therefore, the generated WHERE
clause includes all of the new values inserted.
For example, consider the following insert into the hr.departments
table:
INSERT INTO hr.departments ( department_id, department_name, manager_id, location_id) VALUES (10, 'HR', 20, 40);
The generated WHERE
clause represents the row with the values 10
, 'HR'
, 20
, and 40
. Hence, the generated WHERE
clause is the following:
WHERE "DEPARTMENT_ID" = 10 AND "DEPARTMENT_NAME" = 'HR' AND "MANAGER_ID" = 20 AND "LOCATION_ID" = 40
The ROWID
of an UPDATE
statement is the ROWID
of the row that was updated. The WHERE
clause generated for an UPDATE
operation identifies the row after the UPDATE
executes. The generated WHERE
clause is based on the old and new values of the UPDATE
.
For example, consider the following update to the hr.departments
table:
UPDATE hr.departments SET department_name='Management' WHERE department_name='Administration' AND location_id = 20 AND manager_id = 30 AND department_id = 10;
The values of the row after the UPDATE
are 10
, 'Management'
, 30
, and 20
. Hence, the generated WHERE
clause to identify the row is the following:
WHERE "DEPARTMENT_ID" = 10 AND "DEPARTMENT_NAME" = 'MANAGEMENT' AND "MANAGER_ID" = 30 AND "LOCATION_ID" = 20
Notice that the new value is used for "DEPARTMENT_NAME"
, because the new value is the value of the column after the UPDATE
. For the rest of the columns, the old values are used.
The ROWID
of a DELETE
operation is the row that existed before it was deleted. The generated WHERE
clause consists of all the old column values present in the DELETE
operation.
LOB columns do not appear in generated WHERE
clauses. The generated WHERE
clause is not affected by the presence of LOB columns in the LCR.
This method is overloaded. The different functionality of each form of syntax is presented along with the definitions.
The following procedure returns the WHERE
clause of a SQL statement in a CLOB
datatype.
MEMBER PROCEDURE GET_WHERE_CLAUSE( where_clause IN/OUT CLOB);
The following procedure returns the WHERE
clause of a SQL statement with bind variables in a CLOB
datatype.
MEMBER PROCEDURE GET_WHERE_CLAUSE( where_clause IN/OUT CLOB, variable_list IN/OUT LCR$_ROW_LIST, bind_var_syntax IN VARCHAR2 DEFAULT ':');
Table 275-24 GET_WHERE_CLAUSE Procedure Parameters
Parameter | Description |
---|---|
|
The |
|
The values for the bind variables in the order of the bind variables |
|
The syntax for the bind variables One of the following values is valid:
|
GET_XML_INFORMATION Member Function
Gets the XML information for the specified column.
The return value can be one of the following:
DBMS_LCR.NOT_XML CONSTANT NUMBER := 1; DBMS_LCR.XML_DOC CONSTANT NUMBER := 2; DBMS_LCR.XML_DIFF CONSTANT NUMBER := 3;
DBMS_LCR.NOT_XML
indicates that the column is not an XMLType
column.
DBMS_LCR.XML_DOC
indicates that the column contains an XML document.
DBMS_LCR.XML_DIFF
indicates that the column contains an XML document that describes a change made by an update operation. This XML document describes the differences in the column's XML document. The entire XML document is not replaced.
Returns NULL
if the specified column does not exist.
This procedure keeps a list of columns in a row LCR. The procedure deletes columns that are not in the list from the row LCR.
Table 275-26 KEEP_COLUMNS Procedure Parameters
Parameter | Description |
---|---|
|
The names of the columns kept for the row LCR Specify a comma-delimited list of type |
|
The type of value for which to keep the columns Specify Specify If |
MEMBER PROCEDURE RENAME_COLUMN( from_column_name IN VARCHAR2, to_column_name IN VARCHAR2, value_type IN VARCHAR2 DEFAULT '*');
Table 275-27 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, procedure DML handler, or error handler, you cannot use this member procedure.MEMBER PROCEDURE SET_LOB_INFORMATION( value_type IN VARCHAR2, column_name IN VARCHAR2, lob_information IN NUMBER);
Table 275-28 SET_LOB_INFORMATION Procedure Parameters
Parameter | Description |
---|---|
|
The type of value to set for the column, either Specify |
|
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, procedure DML handler, or error handler, you cannot use this member procedure.MEMBER PROCEDURE SET_LOB_OFFSET( value_type IN VARCHAR2, column_name IN VARCHAR2, lob_offset IN NUMBER);
Table 275-29 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, procedure DML handler, or error handler, you cannot use this member procedure.MEMBER PROCEDURE SET_LOB_OPERATION_SIZE( value_type IN VARCHAR2, column_name IN VARCHAR2, lob_operation_size IN NUMBER);
Table 275-30 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 ProcedureConsiderations for LOB Columns
When processing a row LCR with LOB columns with a procedure DML handler or error handler, and the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), you can 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 an 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 an 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, procedure DML handler, or error handler, you cannot use this member procedure on a LONG
or LONG
RAW
column.
Considerations for XMLType Columns
When processing a row LCR with XMLType
columns with a procedure DML handler or error handler, any XMLType
columns and LOB columns in the LCR are always assembled using LOB assembly. You can use this member procedure in the handler procedure on a row LCR that contains one or more XMLType
columns.
To use a DML or error handler to set the value an XMLType
column, specify the XMLType
for the column_value
parameter. The SET_VALUE
member procedure verifies that an ANYDATA
encapsulated XMLType
is processed with a DML or error handler. An error is raised under the following conditions:
The handler attempts to enqueue a row LCR with an ANYDATA
encapsulated XMLType
.
An attempt is made to set a XMLType
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 XMLType
column is represented by the original (nonassembled) row LCRs.
Note:
Database compatibility must be 11.1.0
or higher to process row LCRs with XMLType
columns.
When you are processing a row LCR with a rule-based transformation, you cannot use this member procedure on XMLType
columns.
MEMBER PROCEDURE SET_VALUE( value_type IN VARCHAR2, column_name IN VARCHAR2, column_value IN ANYDATA);
Table 275-31 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 procedure DML handler or error handler that uses LOB assembly, then specify a LOB locator for LOB columns. |
Replaces all old values or all new values for the LCR, depending on the value type specified.
Considerations for LOB Columns
You can use this procedure when processing a row LCR with LOB columns with a procedure DML handler or error handler. If the handler is using LOB assembly (the assemble_lobs
parameter is set to TRUE
for the handler), then you can use this member procedure in the handler procedure. 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 an 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 an 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, procedure DML handler, or error handler, you cannot use this member procedure on LONG
or LONG
RAW
columns.
Considerations for XMLType Columns
When processing a row LCR with XMLType
columns with a procedure DML handler or error handler, any XMLType
and LOB columns in the LCR are always assembled using LOB assembly. You can use this member procedure in the handler procedure on a row LCR that contains one or more XMLType
columns.
To use a DML or error handler to set the value of one or more XMLType
columns in a row LCR, specify an XMLType
for each XMLType
column in the value_list
parameter. The SET_VALUES
member procedure verifies that an ANYDATA
encapsulated XMLType
is processed with a DML or error handler. An error is raised under the following conditions:
The handler attempts to enqueue a row LCR with an ANYDATA
encapsulated XMLType
.
An attempt is made to set a XMLType
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 XMLType
columns are represented by the original (nonassembled) row LCRs.
Note:
Database compatibility must be 11.1.0
or higher to process row LCRs with XMLType
columns.
When you are processing a row LCR with a rule-based transformation, you cannot use this member procedure on XMLType
columns.
Table 275-32 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 procedure DML handler or error handler that uses LOB assembly, then specify one or more LOB locators for LOB columns. |
Table 275-33 SET_XML_INFORMATION Procedure Parameters
Parameter | Description |
---|---|
|
The name of the column An exception is raised if the column value does not exist in the LCR. |
|
Specify one of the following values: DBMS_LCR.NOT_XML CONSTANT NUMBER := 1; DBMS_LCR.XML_DOC CONSTANT NUMBER := 2; DBMS_LCR.XML_DIFF CONSTANT NUMBER := 3;
|
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 275-34 Summary of Common Subprograms for DDL and Row LCR Types
Subprogram | Description |
---|---|
Gets the command type of the logical change record (LCR) |
|
Gets the commit system change number (SCN) of the transaction to which the current LCR belongs |
|
Gets the commit SCN of a transaction from the input position, which is generated by an XStream outbound server |
|
Gets the commit time of the transaction to which the current LCR belongs |
|
Gets the minimal database compatibility required to support the LCR |
|
Gets the value for the specified extra attribute in the LCR |
|
Gets the name of the object that is changed by the LCR |
|
Gets the owner of the object that is changed by the LCR |
|
Gets the position of the current LCR |
|
Gets the global name of the root for a CDB. |
|
Gets the SCN of the LCR |
|
Gets the SCN from the input position, which is generated by an XStream outbound server |
|
Gets the source database name. |
|
Gets 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 persistent LCR was created |
|
Gets the tag for the LCR |
|
Gets the thread number of the database instance that made the change that is encapsulated in the LCR |
|
Gets 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 global name of the root in a CDB. |
|
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
Gets 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 typesGET_COMMIT_SCN Member Function
Gets 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 procedure DML handler, DDL handler, or error handler.
The commit SCN might not be available for an LCR that is part of an incomplete transaction. For example, persistent LCRs might not have a commit SCN. If the commit SCN is not available for an LCR, then this function returns NULL
.
GET_COMMIT_SCN_FROM_POSITION Static Function
Gets the commit system change number (SCN) of a transaction from the input position, which is generated by an XStream outbound server.
Table 275-35 GET_COMMIT_SCN_FROM_POSITION Function Parameter
Parameter | Description |
---|---|
|
The position You can obtain the position by using the |
Note:
Using XStream requires purchasing a license for the Oracle GoldenGate product. See Oracle Database XStream Guide.Gets the commit time of the transaction to which the current LCR belongs.
The commit time for a transaction is available only during apply or during error transaction execution. This function can be used only in a procedure DML handler, DDL handler, or error handler.
The commit time might not be available for an LCR that is part of an incomplete transaction. For example, persistent LCRs might not have a commit time. If the commit time is not available for an LCR, then this function returns NULL
.
GET_COMPATIBLE Member Function
Gets 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 |
DBMS_STREAMS.COMPATIBLE_11_1 |
11.1.0 |
DBMS_STREAMS.COMPATIBLE_11_2 |
11.2.0 |
DDL LCRs always return DBMS_STREAMS.COMPATIBLE_9_2
.
You can use the following functions in the DBMS_STREAMS
package for constant compatibility return values:
The COMPATIBLE_9_2
function returns the DBMS_STREAMS.COMPATIBLE_9_2
constant.
The COMPATIBLE_10_1
function returns DBMS_STREAMS.COMPATIBLE_10_1
constant.
The COMPATIBLE_10_2
function returns DBMS_STREAMS.COMPATIBLE_10_2
constant.
The COMPATIBLE_11_1
function returns DBMS_STREAMS.COMPATIBLE_11_1
constant.
The COMPATIBLE_11_2
function returns DBMS_STREAMS.COMPATIBLE_11_2
constant.
The MAX_COMPATIBLE
function returns an integer that is greater than the highest possible compatibility constant for the current release of Oracle Database.
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 Oracle 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 Oracle Streams
Chapter 158, "DBMS_STREAMS" and Chapter 159, "DBMS_STREAMS_ADM"
Oracle Database Reference and Oracle Database Upgrade Guide for more information about the COMPATIBLE
initialization parameter
GET_EXTRA_ATTRIBUTE Member Function
Gets the value for the specified extra attribute in the LCR. The returned extra attribute is contained within an 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 ProcedureTable 275-36 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 Language Reference for more information about the current user |
Gets the position of the current LCR. The position uniquely identifies each LCR. The position strictly increases within each transaction and across transactions.
LCR position is commonly used in XStream configurations.
MEMBER FUNCTION GET_POSITION() RETURN RAW;
Note:
Using XStream requires purchasing a license for the Oracle GoldenGate product. See Oracle Database XStream Guide.Gets the global name of the root in a CDB, which is the root name for the LCR.
GET_SCN_FROM_POSITION Static Function
Gets the system change number (SCN) from the input position, which is generated by an XStream outbound server.
Table 275-37 GET_SCN_FROM_POSITION Function Parameter
Parameter | Description |
---|---|
|
The position You can obtain the position by using the |
Note:
Using XStream requires purchasing a license for the Oracle GoldenGate product. See Oracle Database XStream Guide.GET_SOURCE_DATABASE_NAME Member Function
Gets the global name of the source database. The source database is the database where the change occurred.
GET_SOURCE_TIME Member Function
Gets 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 persistent LCR was created.
Gets 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 tagsGET_THREAD_NUMBER Member Function
Gets the thread number of the database instance that made the change that is encapsulated in the LCR. Typically, the thread number is relevant in an Oracle Real Application Clusters configuration.
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 tagsSET_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
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 ProcedureMEMBER PROCEDURE SET_EXTRA_ATTRIBUTE( attribute_name IN VARCHAR2, attribute_value IN ANYDATA);
Table 275-39 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 Language Reference for more information about the current user |
|
The value to which the specified extra attribute is set If set to |
SET_ROOT_NAME Member Procedure
Sets the global name of the root in a CDB. The setting is the root name for the LCR.
SET_SOURCE_DATABASE_NAME Member Procedure
Sets the source database name of the object that is changed by the LCR.
Table 275-43 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 tagsIdentifies 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:
Identifies the value for a column in a row.
This type is used in the LCR$_ROW_LIST
type.
See Also:
LCR$_ROW_LIST TypeCREATE 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); /
Table 275-45 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 Valid values are |
|
If If |
|
Contains the
|