OCIQualifiedSqlNameCheck()

The OCIQualifiedSqlNameCheck() API is a C callable equivalent to the DBMS_ASSERT function DBMS_ASSERT.QUALIFIED_SQL_NAME

Purpose

OCIQualifiedSqlNameCheck() verifies that the input string conforms to the basic characteristics of a qualified SQL name. A qualified SQL name may contain multiple simple SQL names representing the names of schema, object and database links. A qualified SQL name must conform to the following rules:
  • <local qualified name> ::= <simple name> {'.' <simple name>}
  • <database link name> ::= <local qualified name> ['@' <connection string>]
  • <connection string> ::= <simple name>
  • <qualified name> ::= <local qualified name> ['@' <database link name>]

Syntax

sword OCIQualifiedSqlNameCheck(
    OCIEnv   *envhp,
    OCIError *errhp,
    oratext  *in_str,
    ub4       in_str_len,
    ub4       mode
);

Parameters

envhp (IN)

OCI environment handle.

errhp (IN/OUT)

OCI error handle.

in_str (IN)

Input string buffer (not required to be NULL-terminated).

in_str_len (IN)

Length of in_str.

mode (IN)

Mode of operation. (implementation-defined)

Returns

Returns one of the following:
  • OCI_SUCCESS - Input is a qualified SQL name.
  • OCI_ERROR - Input is not a qualified SQL name; error handle contains:
    • ORA-44004 - Invalid qualified SQL name

Usage

Use OCIQualifiedSqlNameCheck() to validate the input is a qualified SQL name before constructing SQL strings, especially when you need to accept names but not necessarily quote/transform them.

Comments

  • Input may be ASCII or UTF-16 depending on the environment (envhp) configuration.
  • For UTF-16, the environment must be created using UTF-16 mode (for example, with OCIEnvCreate(..., OCI_UTF16, ...)).