Requesting Information About the Database Catalog

Use

You use an SQLCLI command to request information about the database catalog of a database instance in the interactive mode.

For information about the other options for executing SQLCLI commands, see Executing Commands.

Prerequisites

You are logged on to a database instance.

Procedure

...

Enter one of the SQLCLI commands listed below.

The SQLCLI returns information about the database objects that correspond to the specified pattern [PATTERN] or [NAME] and to which you have access. If you do not specify a pattern, the system displays information about all the database objects to which you have access.

SQLCLI Commands for Requesting Information About the Database Catalog

Database Object

SQLCLI command

Result

Column

\dc [PATTERN]

·        Name of Column

·        Data type

·        Column length

·        Null value permitted or not

·        Position of column in primary key of table (if applicable)

Index

\de [PATTERN]

·        Index name

·        Columns contained in index

·        Position of column in index

·        Specifies whether index is UNIQUE

·        Sorting

Database Procedure

\dp [PATTERN]

·        Schema name

·        Name of the database procedure

·        Package to which database procedure is assigned

Schema

\ds [NAME]

·        Schema name

·        Owner

Table

\dt [PATTERN]

·        Schema name

·        Table name

·        Table type

Database User

\du [NAME]

·        Name of the database user

·        User Properties

View

\dv [PATTERN]

·        Schema name

·        View name

·        View types

The following syntax applies to the pattern [PATTERN]:

PATTERN

[OWNER.][OBJECT_NAME] or
[SCHEMA.][OBJECT_NAME]

OWNER

Owner of the database objects about which you want to request information

SCHEMA

Schema of the database objects about which you want to request information

OBJECT_NAME

Name of the database object

You can use the following placeholders:

·        For one character: _

·        For any number of characters: %

Example

Requesting information about the columns of the HOTEL.CUSTOMER table:

\dc HOTEL.CUSTOMER

Table "HOTEL.CUSTOMER"
Column Name | Type       | Length | Nullable | KEYPOS
------------+------------+--------+----------+-------
ADDRESS     | CHAR ASCII | 25     | NO       |
CNO         | FIXED      | 4      | NO       | 1
FIRSTNAME   | CHAR ASCII | 10     | YES      |
NAME        | CHAR ASCII | 10     | NO       |
TITLE       | CHAR ASCII | 7      | YES      |
ZIP         | CHAR ASCII | 5      | YES      |
(6 rows selected)