Procedure documentationRequesting Information About the Database Catalog Locate this document in the navigation structure

 

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

Note Note

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

End of the note.

Prerequisites

You are logged on to the database.

More information: Logging On to a Database

Procedure

Enter one of the SQLCLI commands listed below.

SQLCLI returns information about the database objects that correspond to the specified [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: Requesting Information About the Database Catalog

Database Object

SQLCLI Command

Result

Column

\dc [PATTERN]

  • Column name

  • 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

  • Sort sequence

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 users

\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]:

Property

Description

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 on the columns in 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)