SQL*Plus User's Guide and Reference

Contents Index Home Previous Next

Getting Help

While you use SQL*Plus, you may find that you need to list column definitions for a table, or start and stop the display that scrolls by. You may also need to interpret error messages you receive when you enter a command incorrectly or when there is a problem with Oracle or SQL*Plus. The following sections describe how to get help for those situations.

Listing a Table Definition

To see the definitions of each column in a given table, use the SQL*Plus DESCRIBE command.

Example 2-6 Using the DESCRIBE Command

To list the column definitions of the three columns in the sample table DEPT, enter

SQL> DESCRIBE DEPT

The following output results:

Name                            Null?    Type
------------------------------- ------- ----------
DEPTNO                          NOT NULL NUMBER(2)
DNAME                                    CHAR(14)
LOC                                      CHAR(13)

Note: DESCRIBE accesses information in the Oracle data dictionary. You can also use SQL SELECT commands to access this and other information in the database. See your Oracle7 Server SQL Language Reference Manual for details.

Listing PL/SQL Definitions

To see the definition of a function or procedure, use the SQL*Plus DESCRIBE command.

Example 2-7 Using the DESCRIBE Command

To list the definition of a function called AFUNC, enter

SQL> DESCRIBE afunc

The following output results:

FUNCTION afunc RETURNS NUMBER
Argument Name   Type     In/Out   Default?
--------------- -------- -------- ---------
F1              CHAR     IN
F2              NUMBER   IN

Controlling the Display

Suppose that you wish to stop and examine the contents of the screen while displaying a long report or the definition of a table with many columns. Press [Pause]. (Refer to Table 2 - 1 to see how [Pause] is labelled on your keyboard.) The display will pause while you examine it. To continue, press [Resume].

If you wish, you can use the PAUSE variable of the SQL*Plus SET command to have SQL*Plus pause after displaying each screen of a query or report. Refer to SET[*] for details.

Interpreting Error Messages

If SQL*Plus detects an error in a command, it will try to help you out by displaying an error message.

Example 2-8 Interpreting an Error Message

For example, if you misspell the name of a table while entering a command, an error message will tell you that the table or view does not exist:

SQL> DESCRIBE DPT
Object does not exist.

You will often be able to figure out how to correct the problem from the message alone. If you need further explanation, take one of the following steps to determine the cause of the problem and how to correct it:


Contents Index Home Previous Next