GET_TABLE_METADATA

Valid For

Extract and Replicat

Description

Use the GET_TABLE_METADATA function to retrieve metadata about the table that associated with the record that is being processed.

Syntax

#include "usrdecs.h"
short result_code;
table_metadata_def tbl_meta_rec;
ERCALLBACK (GET_TABLE_METADATA, &tbl_meta_rec, &result_code);

Buffer

typedef struct
{
char *table_name;
short value_truncated;
long max_name_length;
long actual_name_length;
short num_columns;
short num_key_columns;
short *key_columns;
short num_keys_returned;
BOOL using_pseudo_key;
short source_or_target;
} table_metadata_def;

Input

<table_name>

A pointer to a buffer to accept the table_name return value

<key_columns>

A pointer to an array of key_columns indexes.

<max_name_length>

The maximum length of the returned table name. Typically, the maximum length is the length of the table name buffer. Since the returned table name is null-terminated, the maximum length should equal the maximum length of the table name.

<source_or_target>

One of the following indicating whether to return the source or target table name.

EXIT_FN_SOURCE_VAL
EXIT_FN_TARGET_VAL

Output

<table_name>

The name of the table associated with the record that is being processed. 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 table name is interpreted in the session character set.

<value_truncated>

A flag (0 or 1) indicating whether or not the value was truncated. Truncation occurs if the length of the table name plus the null terminator exceeds the maximum buffer length.

<actual_name_length>

The string length of the returned table name. The actual length does not include the null terminator.

<num_columns>

The number of columns in the table.

<num_key_columns>

The number of columns in the key that is being used by Oracle GoldenGate.

<key_columns>

The values for the key columns. You must know the expected number of keys multiplied by the length of the columns, and then allocate the appropriate amount of buffer.

<num_keys_returned>

The number of key columns that are requested.

using_pseudo_key

A flag that indicates whether or not KEYCOLS-specified columns are being used as a key. Returns TRUE or FALSE.

Return Values

EXIT_FN_RET_INVALID_PARAM
EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_EXCEEDED_MAX_LENGTH
EXIT_FN_RET_OK