GET_COL_METADATA_FROM_NAME
Valid For
Extract and Replicat
Description
Use the GET_COL_METADATA_FROM_NAME
function to retrieve column metadata by specifying the name of the desired column. If the character session of the user exit is set with SET_SESSION_CHARSET
to a value other than the default character set of the operating system, as defined in ULIB_CS_DEFAULT
in the ucharset.h
file, the character data that is exchanged between the user exit and the process is interpreted in the session character set.
If the database is case-sensitive, object names must be specified in the same letter case as they are defined in the hosting database; otherwise, the case does not matter.
Syntax
#include "usrdecs.h" short result_code; col_metadata_def column_meta_rec; ERCALLBACK (GET_COL_METADATA_FROM_NAME, &column_meta_rec, &result_code);
Buffer
typedef struct { short column_index; char *column_name; long max_name_length; short native_data_type; short gg_data_type; short gg_sub_data_type; short is_nullable; short is_part_of_key; short key_column_index; short length; short precision; short scale; short source_or_target; } col_metadata_def;
Input
-
column_name
-
The column name of the column value to be returned.
-
max_name_length
-
The maximum length of the returned column name. Typically, the maximum length is the length of the name buffer. Since the returned name is null-terminated, the maximum length should equal the maximum length of the column name.
-
source_or_target
-
One of the following to indicate whether the source or target record is being compressed.
EXIT_FN_SOURCE_VAL EXIT_FN_TARGET_VAL
Output
-
column_index
-
The column index of the column value to be returned.
-
actual_name_length
-
The actual length of the returned name.
-
source_or_target
-
One of the following to indicate whether the source or target record is being compressed.
EXIT_FN_SOURCE_VAL EXIT_FN_TARGET_VAL
-
value_truncated
-
A flag (
0
or1
) to indicate whether or not the value was truncated. Truncation occurs if the length of the column name plus the null terminator exceeds the maximum buffer length. -
native_data_type
-
The native (to the database) data type of the column.
-
gg_data_type
-
The Oracle GoldenGate data type of the column.
-
gg_sub_data_type
-
The Oracle GoldenGate sub-type of the column.
-
is_nullable
-
Flag indicating whether the column permits a null value (
TRUE
orFALSE
). -
is_part_of_key
-
Flag (
TRUE
orFALSE
) indicating whether the column is part of the key that is being used by Oracle GoldenGate. -
key_column_index
-
Indicates the order of the columns in the index. For example, the following table has two key columns that are defined in one order in the table and another in the index definition.
CREATE TABLE tcustmer ( cust_code VARCHAR2(4), name VARCHAR2(30), city VARCHAR2(20), state CHAR(2), PRIMARY KEY (city, cust_code) USING INDEX );
The return is as follows:
-
cust_code
returns1
-
name
returns-1
-
city
returns0
-
state
returns-1
If the column is part of the key, its order in the index is returned as an integer.
If the column is not part of the key, a value of -1 is returned.
-
-
length
-
Returns the length of the column.
-
precision
-
If a numeric data type, returns the precision of the column.
-
scale
-
If a numeric data type, returns the scale.
Return Values
EXIT_FN_RET_INVALID_PARAM EXIT_FN_RET_INVALID_CONTEXT EXIT_FN_RET_EXCEEDED_MAX_LENGTH EXIT_FN_RET_INVALID_COLUMN EXIT_FN_RET_OK