IBM Books

Command Reference

LIST PACKAGES/TABLES

Lists packages or tables associated with the current database.

Authorization

For the system catalogs SYSCAT.PACKAGES (LIST PACKAGES) and SYSCAT.TABLES (LIST TABLES), one of the following is required:

Required Connection

Database. If implicit connect is enabled, a connection to the default database is established.

Command Syntax

>>-LIST----+-PACKAGES-+---+--------------------------------+---->
           '-TABLES---'   |      .-USER-----------------.  |
                          '-FOR--+-ALL------------------+--'
                                 +-SCHEMA--schema-name--+
                                 '-SYSTEM---------------'
 
>-----+--------------+-----------------------------------------><
      '-SHOW DETAIL--'
 

Command Parameters

FOR
If the FOR clause is not specified, the packages or tables for USER are listed.

ALL
Lists all packages or tables in the database.

SCHEMA
Lists all packages or tables in the database for the specified schema only.

SYSTEM
Lists all system packages or tables in the database.

USER
Lists all user packages or tables in the database for the current user.

SHOW DETAIL
Displays the full table name (valid for the LIST TABLES command only). If this option is not specified, the name is truncated to 30 characters, and the ">" symbol in the thirty-first column represents the truncated portion of the table name.

Examples

The following is sample output from LIST PACKAGES:



                     Bound    Total                           Isolation
Package    Schema    by       sections      Valid    Format   level     Blocking
---------- --------- -------- ------------- -------- -------- --------- --------
P1         SMITH     SMITH                1 Yes      0        CS        U
 
  1 record(s) selected.

The following is sample output from LIST TABLES:



Table/View         Schema           Type       Creation time
------------------ ---------------- ---------- ----------------------------
DEPARTMENT         SMITH            T          1997-02-19-13.32.25.971890
EMP_ACT            SMITH            T          1997-02-19-13.32.27.851115
EMP_PHOTO          SMITH            T          1997-02-19-13.32.29.953624
EMP_RESUME         SMITH            T          1997-02-19-13.32.37.837433
EMPLOYEE           SMITH            T          1997-02-19-13.32.26.348245
ORG                SMITH            T          1997-02-19-13.32.24.478021
PROJECT            SMITH            T          1997-02-19-13.32.29.300304
SALES              SMITH            T          1997-02-19-13.32.42.973739
STAFF              SMITH            T          1997-02-19-13.32.25.156337
 
  9 record(s) selected.

Usage Notes

LIST PACKAGES and LIST TABLES commands are available to provide a quick Version 1 interface to the system tables. However, Version 2 system tables offer a greater granularity of information, and should be used whenever possible.

The following Version 2 SELECT statements return similar information. They can be expanded to select the additional information that Version 2 provides.

 
   select tabname, tabschema, type, create_time
   from syscat.tables
   order by tabschema, tabname;
 
   select pkgname, pkgschema, boundby, total_sect,
      valid, format, isolation, blocking
   from syscat.packages
   order by pkgschema, pkgname;
 
   select tabname, tabschema, type, create_time
   from syscat.tables
   where tabschema = 'SYSCAT'
   order by tabschema, tabname;
 
   select pkgname, pkgschema, boundby, total_sect,
      valid, format, isolation, blocking
   from syscat.packages
   where pkgschema = 'NULLID'
   order by pkgschema, pkgname;
 
   select tabname, tabschema, type, create_time
   from syscat.tables
   where tabschema = USER
   order by tabschema, tabname;
 
   select pkgname, pkgschema, boundby, total_sect,
      valid, format, isolation, blocking
   from syscat.packages
   where pkgschema = USER
   order by pkgschema, pkgname;


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]