SQL Reference

TABLE_SCHEMA

>>-TABLE_SCHEMA---(--objectname----+------------------+--)-----><
                                   '-,--objectschema--'
 

The schema is SYSIBM.

The TABLE_SCHEMA function returns the schema name of the object found after any alias chains have been resolved. The specified objectname (and objectschema) are used as the starting point of the resolution. If the starting point does not refer to an alias, the schema name of the starting point is returned. The resulting schema name may be of a table, view, or undefined object.

objectname
A character expression representing the unqualified name (usually of an existing alias) to be resolved. objectname must have a data type of CHAR or VARCHAR and a length greater than 0 and less than 129 characters.

objectschema
A character expression representing the schema used to qualify the supplied objectname value before resolution. objectschema must have a data type of CHAR or VARCHAR and a length greater than 0 and less than 129 characters.

If objectschema is not supplied, the default schema is used for the qualifier.

The data type of the result of the function is VARCHAR(128). If objectname can be null, the result can be null; if objectname is null, the result is the null value. If objectschema is the null value, the default schema name is used. The result is the character string representing a schema name. The result schema could represent the schema name for one of the following:

table
The value for objectname was either a table name (the input or default value of objectschema is returned) or an alias name that resolved to a table for which the schema name is returned.

view
The value for objectname was either a view name (the input or default value of objectschema is returned) or an alias name that resolved to a view for which the schema name is returned.

undefined object

The value for objectname was either an undefined object (the input or default value of objectschema is returned) or an alias name that resolved to an undefined object for which the schema name is returned.

Therefore, if a non-null objectname value is given to this function, a value is always returned, even if the object name with the result schema name does not exist. For example, TABLE_SCHEMA('DEPT', 'PEOPLE') returns 'PEOPLE ' if the catalog entry is not found.

Examples:


[ Top of Page | Previous Page | Next Page ]