8.41 GET_TABLE_NAME_ONLY

Valid For

Extract and Replicat

Description

Use the GET_TABLE_NAME_ONLY function to retrieve the unqualified name (without the catalog, container, or schema) of the source or target table associated with the record being processed. This function is valid only for tables in DML and DDL operations. To retrieve the unqualified name of a non-table object, see the following:

GET_OBJECT_NAME_ONLY

To return the fully qualified name of a table, see the following:

GET_TABLE_NAME

To return other parts of the table name, see the following:

GET_SCHEMA_NAME_ONLY GET_CATALOG_NAME_ONLY

Database object names are returned exactly as they are defined in the hosting database, including the letter case.

This function returns a value only if the object is a table. Otherwise, the actual_length of the env_value_def variable returns 0.

Syntax

#include "usrdecs.h"
short result_code;
env_value_def env_value;
ERCALLBACK (GET_TABLE_NAME_ONLY, &env_value, &result_code);

Buffer

typedef struct
{
char *buffer;
long max_length;
long actual_length;
short value_truncated;
short index;
short source_or_target;
} env_value_def;

Input

buffer

A pointer to a buffer to accept the returned table name. The table name is null-terminated.

max_length

The maximum length of your allocated buffer to accept the table name. This is returned as a NULL terminated string.

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

buffer

The fully qualified, null-terminated table name, for example schema.table or catalog.schema.table, depending on the database platform.

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.

actual length

The string length of the returned table name. The actual length does not include the null terminator. The actual length returned is 0 if the object is anything other than a table.

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.

Return Values

EXIT_FN_RET_INVALID_COLUMN
EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_INVALID_PARAM
EXIT_FN_RET_OK