Describe functions

2024-05-14 09:02:08  Updated

OCIDescribeAny

Purpose : You can call this function to describe existing schema and subschema objects.

Syntax :

sword OCIDescribeAny ( OCISvcCtx       *svchp,
OCIError        *errhp,
void            *objptr,
ub4              objptr_len,
ub1              objptr_typ,
ub1              info_level,
ub1              objtyp,
OCIDescribe     *dschp );

Parameters :

Parameter Description
svchp (IN) A service context handle.
errhp (IN/OUT) An error handle. When an error occurs, you can pass it to the OCIErrorGet function to obtain diagnostic information.
objptr (IN) For information about objptr (IN), see the objptr (IN) section below the table.
objnm_len (IN) The length of the name string to which objptr points. If you pass a name, the parameter value must not be zero. However, if objptr is a pointer to a type descriptor object (TDO) or its REF, the parameter value can be zero.
objptr_typ (IN) The type of the object that is passed in objptr. If objptr points to the name of a schema object, the valid value of this parameter is OCI_OTYPE_NAME.
info_level (IN) This parameter is reserved for future use. Pass in OCI_DEFAULT.
objtyp (IN) The type of the schema object that is described. For information about the valid values, see the table in the following Valid values of objtyp (IN) section.
dschp (IN/OUT) A description handle that is populated with the description of the object after the call. The parameter value must not be NULL.

Return value : None.

objptr (IN)

This parameter can be a string that contains the name of the object to be described. It must be in the encoding specified by the charset parameter in the previous call to the OCIEnvNlsCreate() function.

In this case, the string that contains the object name must be in the name1[.name2 ...][@linkname] format. Example: hr.employees.employee_id@mydb. Database links are allowed only to Oracle8i or later databases. The following SQL rules are used to interpret the object name:

  • If you only specify name1, and objtyp equals OCI_PTYPE_SCHEMA, the name refers to the named schema. The Oracle database must be version 8.1 or later.

  • If you only specify name1, and objtyp equals OCI_PTYPE_DATABASE, the name refers to the named database. When you use database_name@db_link_name to describe a remote Oracle database, the remote database must be version 8.1 or later.

  • If you only specify name1, and objtyp is not equal to OCI_PTYPE_SCHEMA or OCI_PTYPE_DATABASE, the name refers to the named object in the current schema of the current user. The named object can be a table, view, procedure, function, package, type, synonym, or sequence. When an Oracle7 Server is connected, the named object can only be a procedure or function.

  • If you specify name1.name2.name3 ..., the object name refers to a schema or a subschema object in the schema named name1. For example, in the string hr.employees.department_id, hr is the name of the schema, employees is the name of a table in the schema, and department_id is the name of a column in the table.

Valid values of objtyp (IN)

Object type Description
OCI_PTYPE_TABLE A table.
OCI_PTYPE_VIEW A view.
OCI_PTYPE_PROC A procedure.
OCI_PTYPE_FUNC A function.
OCI_PTYPE_DATABASE A database.
OCI_PTYPE_UNK An unknown schema object.

Contact Us