Anda di halaman 1dari 54

4623-6 AppC.f.

qc 1/28/00 12:37 PM Page 1005

SQL*Plus
Reference
C
A P P E N D I X

✦ ✦ ✦ ✦

T his appendix describes the many commands available


from SQL*Plus. Before presenting the list of SQL*Plus
commands, the appendix describes command argument
strings and display formats, including character, date, and
number formats. Then the commands are presented in
alphabetical order.

String Parameters in SQL*Plus


Commands
Many SQL*Plus commands accept character strings as
parameters. The DEFINE command is a good example. It’s
used to define user variables. You can get a good idea of how
it works from this example:

SQL> DEFINE x = Animals


SQL> DEFINE x = ‘Animals’
SQL> DEFINE x = “Animals”

Notice the three different ways that the strings can be


represented. In the first command, no quotes are used to
delimit the string. SQL*Plus allows this for most SQL*Plus
commands. However, not quoting your strings can lead to
problems. In some cases, it could be ambiguous whether a
given string of characters represents a value or a clause in a
command. It’s better to quote your strings, and you can do
so using either single or double quotes.

Note If your string consists of more than one word, enclose it


within quotes.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1006

1006 Appendixes

If you need to embed quotes within a quoted string, you can either double them up
or use different quotes inside and outside the string. For example:

SQL> DEFINE x=”The Animal’s Home”


SQL> DEFINE x=’The Animal’’s Home’

The first example uses double quotes to enclose the string, which allows single
quotes to be used inside the string. The second example uses single quotes to
enclose the string, which means that a double single quote (‘’) is used inside the
string to represent one single quote.

SQL*Plus Display Formats


Several SQL*Plus commands use format strings either to format output or to
specify the format in which a user must enter a value. The COLUMN and ACCEPT
commands provide good examples. Three types of format strings exist: those used
for characters, those used for dates, and those used for numbers.

Character format strings


Your options are simple when it comes to formatting text columns. SQL*Plus
recognizes only one character format, and that is the A format. You use it to specify
the width of a displayed value. Here are some examples:

COLUMN animal_name FORMAT A10


ACCEPT x CHAR PROMPT ‘Enter X:’ FORMAT A5

The first command causes the animal_name column to be displayed in a ten-


character-wide field. The COLUMN command affects the format of the animal_name
column returned by a SELECT query. The second example here uses a format string
of A5 with an ACCEPT command that requires the user to enter a character string
that is five characters long or less.

Date format strings


You can’t use date format strings with the COLUMN command, but you can use them
with ACCEPT. Consider this example:

ACCEPT x DATE PROMPT ‘Enter Date:’ FORMAT “mm/dd/yyyy”

This command prompts you to enter a date in the month, day, and year format
commonly used in the U.S. You can use a number of date format elements in a
format specification. See Table B-2 in Appendix B, “SQL Built-in Function
Reference,” for a complete list.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1007

Appendix C ✦ SQL*Plus Reference 1007

Number format strings


SQL*Plus supports most, but not all, of the same numeric format elements that you
can use with the built-in TO_CHAR and TO_NUMBER functions. Table C-1 shows the
elements that SQL*Plus supports.

Table C-1
SQL*Plus Numeric Format Elements
Element Sample Description

, 999,999 Marks the location of the comma in a formatted number.


G 999G999 Returns the group separator (usually a comma in the U.S.)
as specified by the NLS_NUMERIC_CHARACTER setting.
This is a language-dependent value.
. 9.99 Marks the location of the decimal point in a formatted
number.
D 9D99 Marks the location of the decimal point as specified by the
NLS_NUMERIC_CHARACTER setting. This is a language-
dependent value.
$ $999,999.99 Marks the location of a leading dollar sign in a formatted
number.
C C999,999.99 Marks the location of the currency symbol as specified by
the NLS_ISO_CURRENCY parameter. This is a language-
dependent value.
L L999,999.99 Marks the location of the currency symbol, as specified by
the NLS_CURRENCY parameter.
0 0999 Marks a location in the number at which you want to begin
displaying leading zeros.
9 9.99 Marks the location of a digit. Note that if no sign is specified
in a number format, positive numbers will be formatted
with one leading space to allow for a negative sign.
EEEE 999.9EEEE Causes a number to be formatted using scientific notation.
MI 999,999MI Formats negative numbers with a trailing negative sign and
positive numbers with a trailing blank.
PR 999pr Formats negative numbers within < and > characters.
RN RN Formats a number in uppercase Roman numerals.
rn rn Formats a number in lowercase Roman numerals.

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1008

1008 Appendixes

Table C-1 (continued)


Element Sample Description

S s999,999 Formats both negative and positive values with a leading –


999,999s or + sign. The S may also be placed at the end of the
number, in which case, the sign becomes a trailing sign.
V 999v999 Multiplies a value by 10 raised to the power specified by the
number of 9s trailing the V character.

You can use the elements listed in Table C-1 with the COLUMN command to format
numeric output. Consider these examples:

COLUMN id_no FORMAT 99999


COLUMN tank_no FORMAT 09999

The first example formats the ID_NO column to display in a five-digit-wide field. The
second example performs the same task for the TANK_NO column, but with the
added requirement that leading zeros be used. In both cases, SQL*Plus will leave
one space in front of the number for possible negative signs.

SQL*Plus Command Reference


The remainder of this appendix lists SQL’s functions in alphabetical order. The
following example uses the SQL SELECT statement to illustrate the notation used in
the syntax diagrams:

SELECT [ALL|DISTINCT] {*|column}


FROM table_name[,table_name...];

SELECT Words in capitals denote syntax —


usually the function names.
column Lowercase italics represent items that
you must supply when you invoke the
function.
[ALL|DISTINCT] Square brackets denote an optional
choice, with the choices delimited by a
vertical line. In this example, you may
choose ALL, DISTINCT, or nothing.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1009

Appendix C ✦ SQL*Plus Reference 1009

{* | column } Curly brackets denote a mandatory


choice, with the choices delimited by a
vertical line. In this example, you have
to choose between * or column.
table_name[,table_name...] Repetitions are indicated by repeating
the item between square brackets and
adding an optional delimiter and three
trailing dots at the end. In this example,
specify one or more data sources, each
delimited by a comma.

@
You use the @ command to execute a SQL*Plus script file. Following is its syntax:

@filename [arg arg arg...]

The syntax elements are as follows:

filename The name of the file that you want to execute. The file name
may optionally include a directory path and an extension. The
default extension is .sql. If no path is specified, SQL*Plus will
look in the current working directory for the file. If it’s not
found there, SQL*Plus will then search the directories listed in
the SQLPATH environment variable.
arg An argument that you want to pass to the script. You can have
as many arguments as you like. They must be separated from
each other by at least one space, and they may optionally be
enclosed within quotes.

To execute a file named create_user.sql in the current directory, enter the


following:

SQL> @create_user

To execute the same file and pass a username as an argument, enter the following:

SQL> @create_user “kim”

@@
You can use the @@ command from within one SQL*Plus script to invoke another.
SQL*Plus will begin searching for the second script in the directory containing the
first. If you have two scripts in the same directory and one calls the other, you
should use the @@ command. Otherwise, if you have another script in the SQLPATH
with the same name, you could run into problems. Following is its syntax:

@@filename [arg arg arg...]


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1010

1010 Appendixes

The syntax elements are as follows:

filename The name of the file that you want to execute. The file name
may optionally include a directory path and an extension. The
default extension is .sql. If no path is specified, SQL*Plus will
look in the directory containing the current script. If you
execute @@ interactively, it functions just like @.
arg An argument that you want to pass to the script. You can have
as many arguments as you like. They must be separated from
each other by at least one space, and they may optionally be
enclosed within quotes.

In the following example, you want the create_user script to execute a


create_user_2 script. Both scripts are stored in the same directory.

@@create_user_2

/
The / command executes the SQL statement currently in the buffer. The buffer
always contains the most recent SQL statement or PL/SQL block that you have
entered or executed.

Note Use the L command to display the statement currently in the buffer.

Following is its syntax:

In the following example, the L command is used to list the contents of the buffer,
and the / command is then used to execute those contents.

SQL> L
1* SELECT USER FROM DUAL
SQL> /

USER
------------------------------
SYSTEM

ACCEPT
The ACCEPT command interactively prompts the user for input and accepts a
response. Following is its syntax:

ACC[EPT] user_var [NUM[BER]|CHAR|DATE]


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1011

Appendix C ✦ SQL*Plus Reference 1011

[FOR[MAT] format] [DEF[AULT] default]


[PROMPT prompt_text|NOPR[OMPT]] [HIDE]

The syntax elements are as follows:

user_var Specifies the name of a SQL*Plus user variable. Note that


you don’t need to declare this variable before using it.
NUMBER Requires the user to enter a number.
CHAR Allows the user to enter any string of characters. This is
the default behavior.
DATE Requires the user to enter a date.
FORMAT format Allows you to specify the format in which the data must
be entered. See the earlier section “SQL*Plus Display
Formats” for information on format specifications.

Note Avoid complicated date and numeric formats. This feature is poorly implemented,
and specifying a complex format can result in a catch-22 situation where nothing
that you enter is accepted. Try accepting a number using a format of $999. You’ll
see that no matter how you attempt to enter a number, it won’t be accepted.

DEFAULT default Allows you to specify a default value, which is


used if the user responds to the prompt by
pressing Enter.
PROMPT prompt_text Defines a prompt that is displayed to the user.
NOPROMPT Inhibits the display of a prompt.
HIDE Prevents the user’s response from being displayed
on the screen as it is typed.

In the following example, ACCEPT is used to prompt for a name:

SQL> ACCEPT name CHAR PROMPT ‘Enter your name:’


Enter your name:Kim Beanie

In this next example, ACCEPT is used to prompt for a numeric value. The format
string $999 is used. The result is that nothing passes validation.

SQL> ACCEPT test NUMBER FORMAT $999


23
SP2-0598: “23” does not match input format “$999”
$23
SP2-0425: “$23” is not a valid number
233
SP2-0598: “233” does not match input format “$999”
$233
SP2-0425: “$233” is not a valid number
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1012

1012 Appendixes

If you use format strings with numbers, stick with simple formats made up of “9”s
and “.”s.

APPEND
The APPEND command appends text to the end of the current line of the SQL buffer.
Following is its syntax:

A[PPEND] text

The syntax elements are as follows:

text The text that you want to append

The example in Listing C-1 shows a SQL statement being entered, listed, and
modified using the APPEND command. Note that APPEND may be abbreviated to A.

Listing C-1: A SQL statement using the APPEND command


SQL> SELECT
2 FROM DUAL
3
SQL> L
1 SELECT
2* FROM DUAL
SQL> 1
1* SELECT
SQL> A USER
1* SELECT USER
SQL> L
1 SELECT USER
2* FROM DUAL

It’s difficult to see on paper, but two spaces are used following the A to get one
space between the words SELECT and USER.

ARCHIVE LOG
The ARCHIVE LOG command allows you to start and stop archiving from SQL*Plus.
This command also allows you to view current information about archiving and to
initiate the manual archiving of log files.

Note You must be logged on as SYSDBA, SYSOPER, or INTERNAL to use this command.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1013

Appendix C ✦ SQL*Plus Reference 1013

Following is its syntax:

ARCHIVE LOG {LIST|STOP}


|{START|NEXT|ALL|log_seq_num} [TO destination]

The syntax elements are as follows:

LIST Displays information about the current state of


archiving.
STOP Stops automatic archiving.
START Starts automatic archiving.
NEXT Archives the next unarchived log file in sequence.
log_seq_num A log sequence number. The corresponding log file is
archived.
TO destination Overrides the archive log destination for this one
operation.

The following example shows the current state of archiving being displayed and
then shows automatic archiving being stopped:

SQL> ARCHIVE LOG LIST


Database log mode Archive Mode
Automatic archival Enabled
Archive destination d:\oradata\coin
Oldest online log sequence 16033
Next log sequence to archive 16038
Current log sequence 16038
SQL> ARCHIVE LOG STOP
Statement processed.

ATTRIBUTE
The ATTRIBUTE command allows you to specify the display format for an attribute
of an object column. Following is its syntax:

ATTRIBUTE [type_name.attribute_name [option...]


option := {ALI[AS] alias_name
|CLE[AR]
|FOR[MAT] format
|LIKE {type_name.attribute_name|alias_name}
|ON
|OFF}

The syntax elements are as follows:

type_name Specifies the name of an Oracle8i object type.


attribute_name Specifies the name of an attribute of the object type.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1014

1014 Appendixes

ALIAS alias_name Defines an alternate name for the attribute that


SQL*Plus will recognize. You can use this name in
future ATTRIBUTE commands.
CLEAR Resets the display format for the attribute to the
default.
FORMAT format Specifies a display format for the attribute. See the
earlier section “SQL*Plus Display Formats” for
information on format specifications.
LIKE Allows you to define this display of this attribute to
be like another. You can name the other attribute by
name or by alias.
ON Enables the display format that you have defined.
OFF Disables the display format that you have defined.
The default will be used instead.

Listing C-2 shows how the ATTRIBUTE command is used to control the display
width of the ID_NO and TANK_NO attributes.

Listing C-2: Using the ATTRIBUTE command


SQL> SELECT * FROM a_animals;

ANIMAL(ID_NO, TANK_NO, ANIMAL_NAME, MARKINGS_DESCRIPTION, BIRTH_DATE,


DEATH_DATE)
--------------------------------------------------------------------------------
--
A_ANIMAL(505, 1, ‘Barney’, ‘No markings’, ‘01-JAN-00’, NULL)
A_ANIMAL(506, 1, ‘Blurry’, ‘No markings’, ‘01-JAN-00’, NULL)

2 rows selected.

SQL> ATTRIBUTE a_animal.id_no FORMAT 09999


SQL> ATTRIBUTE a_animal.tank_no FORMAT 09999
SQL> SELECT * FROM A_ANIMALS;

ANIMAL(ID_NO, TANK_NO, ANIMAL_NAME, MARKINGS_DESCRIPTION, BIRTH_DATE,


DEATH_DATE)
--------------------------------------------------------------------------------
--
A_ANIMAL(00505, 00001, ‘Barney’, ‘No markings’, ‘01-JAN-00’, NULL)
A_ANIMAL(00506, 00001, ‘Blurry’, ‘No markings’, ‘01-JAN-00’, NULL)
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1015

Appendix C ✦ SQL*Plus Reference 1015

Notice that in the second set of results, after the ATTRIBUTE commands were
issued, both columns displayed five digits wide with leading zeros.

BREAK
The BREAK command allows you to define report breaks. Following is its syntax:

BRE[AK] [ON element [action [action...]]...]

element := {column_name|expression|ROW|REPORT}

action := {SKI[P] lines|SKI[P] PAGE


|NODUP[LICATES]|DUP[LICATES]}

The syntax elements are as follows:

column_name The name of a column in a SQL query. This defines a


column break, and the corresponding actions will be
executed each time the column’s value changes.

Note If you define column aliases in your SQL query, then use those aliases as column
names in the BREAK command.

expression Specifies an expression used in a SQL query. The


expression must match exactly the one used in the query.
This defines the equivalent of a column break, but for an
expression. Note that it’s usually easier to alias the
expression instead.
ROW Defines a break that executes for each row returned by a
query.
REPORT Defines a break that executes at the end of a report.
SKIP lines Skips the specified number of lines when the break
occurs.
SKIP PAGE Skips a page when the break occurs.
NODUPLICATES Eliminates repeating values in a column. This is the
default behavior.
DUPLICATES Allows repeating values to be displayed.

The most common use of BREAK is to eliminate repeating values from a column.
Consider the example shown in Listing C-3.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1016

1016 Appendixes

Listing C-3: Using the BREAK command


SQL> SELECT tank_no, animal_name FROM aquatic_animal
2 ORDER BY tank_no;

TANK_NO ANIMAL_NAME
--------- ------------------------------
1 Flipper
1 Skipper
1 Bopper
2 Batty
2 Shorty
2 Squacky
2 Paintuin
3 Nosey
3 Rascal
3 Snoops

10 rows selected.

SQL> BREAK ON tank_no


SQL> SELECT tank_no, animal_name FROM aquatic_animal
2 ORDER BY tank_no;

TANK_NO ANIMAL_NAME
--------- ------------------------------
1 Flipper
Skipper
Bopper
2 Batty
Shorty
Squacky
Paintuin
3 Nosey
Rascal
Snoops

10 rows selected.

The BREAK command can also be used to skip a line between each group of animals,
as shown in Listing C-4.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1017

Appendix C ✦ SQL*Plus Reference 1017

Listing C-4: Using the BREAK command to skip lines


SQL> BREAK ON tank_no NODUPLICATES SKIP 1
SQL> SELECT tank_no, animal_name FROM aquatic_animal
2 ORDER BY tank_no;

TANK_NO ANIMAL_NAME
--------- ------------------------------
1 Flipper
Skipper
Bopper

2 Batty
Shorty
Squacky
Paintuin

3 Nosey
Rascal
Snoops

10 rows selected.

Notice that each time the tank number changes, a line is skipped. The BREAK
command defining this behavior contains two break actions. Even though it is a
default action, NODUPLICATES is included so that you can see how multiple actions
are specified.

Note When you define a column break, always make sure that the query results are
sorted by the break column.

BTITLE
The BTITLE command defines a footer (bottom title) that appears at the bottom of
each page of a report. Following is its syntax:

BTI[TLE] [printspec [text|user_var]... [printspec...]]


|[OFF|ON]

printspec := {COL col_num


|S[KIP] lines
|TAB col_num
|LE[FT]
|CE[NTER]
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1018

1018 Appendixes

|R[IGHT]
|BOLD
|FORMAT format}

The syntax elements are as follows:

text Specifies text that you want to appear as part of the title.
user_var Specifies the name of a user variable, the contents of
which will appear in the title. This may also be one of
the following predefined user variables: SQL.LNO for the
current line number, SQL.PNO for the current page
number, SQL.RELEASE for the current Oracle release
number, SQL.SQLCODE for the current error number, and
SQL.USER for the current username.
COL col_num Indents to the specified column.
SKIP lines Skips the specified number of lines.
LEFT Causes subsequent text to appear left-justified in the
current line.
CENTER Causes subsequent text to appear centered in the
current line. Note that the definition of center is
controlled by the SET LINESIZE command.
RIGHT Causes subsequent text to appear flush right. Note that
the SET LINESIZE command also defines the right edge
of the line.
BOLD Causes text to be printed three times in succession, on
three different lines.
FORMAT format Specifies a display format to use for subsequent text or
numeric values. See the earlier section “SQL*Plus
Display Formats” for details on specifying format strings.
OFF Turns the page footer off.
ON Turns the page footer on.

The following example setting defines a two-line page footer:

SQL> BTITLE LEFT ‘Page’ FORMAT 999 sql.pno -


> RIGHT ‘Confidential’ -
> SKIP 1 CENTER ‘Payroll Department’

Note The hyphen in SQL*Plus is a line continuation character. When used, it must be
preceded by a space.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1019

Appendix C ✦ SQL*Plus Reference 1019

Assuming a 50-character-wide line, this footer will display as follows:

Page 1 Confidential
Payroll Department

You can use the BTITLE command with no arguments to see the current title
setting, as shown in this example:

SQL> BTITLE
btitle ON and is the following 102 characters:
LEFT ‘Page’ FORMAT 999 sql.pno RIGHT ‘Confidential’ SKIP 1
CENTER ‘Payroll Department’

CHANGE
The CHANGE command allows you to perform string substitution on the current line
of the SQL buffer. Following is its syntax:

C[HANGE] /old_text/new_text/

The syntax elements are as follows:

old_text The text that you want to replace.


new_text The new text that you want to use.
/ The separator character. You can use any character as the
separator character. SQL*Plus interprets the first nonspace
character following the CHANGE command as the separator. The
trailing separator character is optional, unless your new_text
value contains trailing spaces.

In the following example, a query is entered with the wrong column name in the
SELECT list. The L command is used to list the first line, and the column name is
replaced.

SQL> SELECT animal_name


2 FROM aquatic_animal
3
SQL> L 1
1* SELECT animal_name
SQL> C /animal_name/COUNT(*)/
1* SELECT COUNT(*)
SQL> L
1 SELECT COUNT(*)
2* FROM aquatic_animal
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1020

1020 Appendixes

CLEAR
The CLEAR command allows you to erase various types of SQL*Plus settings.
Following is its syntax:

CL[EAR] {BRE[AKS]
|BUFF[ER]
|COL[UMNS]
|COMP[UTES]
|SCR[EEN]
|SQL
|TIMI[NG]

The syntax elements are as follows:

BREAKS Erases all break settings


BUFFER Erases the contents of the current buffer
COLUMNS Erases all column format settings
COMPUTES Erases all COMPUTE settings
SCREEN Clears the screen
SQL Erases the contents of the SQL buffer
TIMING Deletes any timers that you have created using the TIMING
command

The following commands clear any break and column settings:

SQL> CLEAR BREAKS


breaks cleared
SQL> CLEAR COLUMNS
columns cleared
SQL>

COLUMN
The COLUMN command formats columns for display on a report. Listing C-5 shows
its syntax.

Listing C-5: COLUMN command syntax


COL[UMN] [column_name [option option...]]

option := {ALI[AS] alias|


CLE[AR]|
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1021

Appendix C ✦ SQL*Plus Reference 1021

FOLD_A[FTER]|
FOLD_B[EFORE]|
FOR[MAT] format|
HEA[DING] heading_text|
JUS[TIFY] {LEFT|CENTER|CENTRE|RIGHT}|
LIKE source_column_name|
NEWL[INE]|
NEW_V[ALUE] user_var|
NOPRI[NT]|
PRI[NT]|
NUL[L] null_text|
OLD_V[ALUE] user_var|
ON|
OFF|
WRA[PPED]|
WOR[D_WRAPPED]|
TRU[NCATED]}

The syntax elements are as follows:

column_name Identifies the column that you are


formatting. If you use column aliases in your
SQL statement, then those aliases become
the column names as far as SQL*Plus is
concerned.
ALIAS alias Allows you to specify an alternate name for
this column that SQL*Plus will recognize.
CLEAR Resets the display format of this column
back to its default.
FOLD_AFTER Specifies that SQL*Plus should advance to a
new line after displaying the column’s value.
FOLD_BEFORE Specifies that SQL*Plus should advance to a
new line before the column’s value is
displayed.
FORMAT format Allows you to specify a display format for
the column. See the earlier section
“SQL*Plus Display Formats” for more
information.
HEADING Allows you to define a column heading that
displays at the top of the column.
JUSTIFY Controls the justification of the heading text.
Use one of these keywords: LEFT, RIGHT,
CENTER, or CENTRE.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1022

1022 Appendixes

LIKE source_column_name Defines the column’s display format to be


like that of another column.
NEWLINE Has the same effect as FOLD_BEFORE.
NEW_VALUE user_var Tells SQL*Plus to update the named user
variable with the current contents of the
column as the query executes.
NOPRINT Inhibits the display of the column.
PRINT Allows the column to be displayed.
NULL null_text Specifies text to be displayed whenever the
column contains a null value.
OLD_VALUE user_var Tells SQL*Plus to update the named user
variable with the current contents of the
column as the query executes.
ON Enables the column format that you have
defined.
OFF Disables the display format that you have
defined.
WRAPPED Causes SQL*Plus to wrap long values to fit
within the column. This is the default
behavior.
WORD_WRAPPED Causes SQL*Plus to wordwrap long values.
TRUNCATED Causes SQL*Plus to truncate values longer
than the column is wide.

The following example shows the COLUMN command being used to set the display
format and headings for two columns:

SQL> COLUMN id_no FORMAT 999 HEADING ‘Animal ID’


SQL> COLUMN animal_name FORMAT A10 HEADING ‘Name’
SQL> SELECT id_no, animal_name
2 FROM aquatic_animal;

Animal ID Name
--------- ----------
100 Flipper
105 Skipper
112 Bopper
151 Batty
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1023

Appendix C ✦ SQL*Plus Reference 1023

COMPUTE
The COMPUTE command allows you to define summaries for SQL*Plus to compute
and display. Following is its syntax:

COMP[UTE] [function [LAB[EL] label_text]...


OF {expression|column|alias}...
ON {expression|column|alias|REPORT|ROW}...]

The syntax elements are as follows:

function One of the functions listed in Table C-2.

Table C-2
Functions You Can Use with COMPUTE
Function Name Description

AVG Computes the average of all non-null values in the column.


COU[NT] Computes the number of non-null values in the column.
MAX[IMUM] Computes the maximum value of a column.
MIN[IMUM] Computes the minimum value of a column.
NUM[BER] Computes the number of rows. This is similar to COUNT but includes
null values.
STD Computes the standard deviation of the values in a column.
SUM Computes the sum of the values in a column.
VAR[IANCE] Computes the variance of the non-null values in a column.

label_text An optional label for the computation. SQL*Plus attempts to


display this in the column preceding the one named in the
COMPUTE statement.
expression An expression that identifies a column returned by a SQL
query. This expression must match an expression in the
SELECT statement.
column The name of a column returned by a SELECT statement.
alias An alias previously defined using the COLUMN command.
OF Introduces the list of columns being summarized. You may
summarize multiple columns with one command.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1024

1024 Appendixes

ON Introduces the list of break columns for which the


summarized values are displayed.
REPORT Defines a report-level summary.
ROW Defines a row-level summary.

Note The COMPUTE and BREAK commands work together. You can have only one COM-
PUTE setting for a database.

The example shown in Listing C-6 uses the COMPUTE command to print a count of
the animals in each tank.

Listing C-6: Using the COMPUTE command


SQL> COMPUTE COUNT LABEL ‘Count’ OF animal_name ON tank_no
SQL> BREAK ON tank_no
SQL> SELECT tank_no, animal_name
2 FROM aquatic_animal;

TANK_NO ANIMAL_NAME
--------- ------------------------------
1 Flipper
Skipper
Bopper
********* ------------------------------
Count 3
2 Batty
Shorty
Squacky
Paintuin
********* ------------------------------
Count 4
3 Nosey
Rascal
Snoops
********* ------------------------------
Count 3

For COMPUTE to work, you must BREAK on the column listed in the ON clause of the
COMPUTE command. You should also sort the results of your query based on that
same column. Note that the label ‘Count’ is displayed in the column preceding the
one being counted. Oracle determines the preceding column based on the order in
the select list. If the previous column is defined as NOPRINT, then you won’t see the
compute label.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1025

Appendix C ✦ SQL*Plus Reference 1025

CONNECT
You use the CONNECT command to connect to a database from SQL*Plus. Following
is its syntax:

CONN[ECT] [[username[/password][@service]]
[AS {SYSOPER|SYSDBA}] [INTERNAL]]

The syntax elements are as follows:

username Specifies your Oracle username


password Specifies your password
service Specifies a Net8 service name
SYSOPER Connects you in the SYSOPER role
SYSDBA Connects you in the SYSDBA role
INTERNAL Connects you as the INTERNAL role

The following example shows how to connect normally using the SYSDBA role:

SQL> CONNECT system/manager


Connected.
SQL> CONNECT system/manager AS SYSDBA
Connected.

If you omit your password, SQL*Plus will prompt you for it, as follows:

SQL> CONNECT system@seapark_db


Enter password: *******
Connected.

COPY
The COPY command allows you to copy data from one table to another table. The
tables may be in different databases. Following is its syntax:

COPY {FROM login|TO login}


{APPEND|CREATE|INSERT|REPLACE}
destination_table [(column_list)]
USING select_statement

login := username/password@service
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1026

1026 Appendixes

The syntax elements are as follows:

username Specifies your Oracle username.


password Specifies your password.
service Specifies a Net8 service name.
APPEND Creates the destination table if it doesn’t already
exist.
CREATE Creates the destination table.
INSERT Causes SQL*Plus to return an error if the
destination table doesn’t exist.
REPLACE Deletes the data in the destination table before
doing the copy. The table will be created if it
doesn’t already exist.
destination_table Identifies the table to which you are copying
the data.
column_list Identifies the list of columns in the destination table
that are to receive the data being copied.
select_statement Specifies the SELECT statement that retrieves the
data that you want to copy.

The example in Listing C-7 shows the COPY command being used to copy the ID_NO
and ANIMAL_NAME columns of the AQUATIC_ANIMAL table to a new table in a remote
database.

Listing C-7: Copy example


SQL> COPY TO seapark/seapark@seapark_remote -
> CREATE aquatic_animal_copy -
> USING SELECT id_no, animal_name -
> FROM aquatic_animal;

Array fetch/bind size is 15. (arraysize is 15)


Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
Table AQUATIC_ANIMAL_COPY created.

10 rows selected from DEFAULT HOST connection.


10 rows inserted into AQUATIC_ANIMAL_COPY.
10 rows committed into AQUATIC_ANIMAL_COPY at seapark@seapark_remote.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1027

Appendix C ✦ SQL*Plus Reference 1027

DEFINE
The DEFINE command allows you to create a SQL*Plus user variable and assign it
a value. The DEFINE command also allows you to list the values of all currently
defined user variables. Following is its syntax:

DEF[INE] [variable [= text]]

The syntax elements are as follows:

variable The name that you want to give the user variable that you are
defining
text The text string that you want to assign to the variable

The following examples show how to use the DEFINE command to define some user
variables and then to display their definitions:

SQL> DEFINE x = “Seapark”


SQL> DEFINE x
DEFINE X = “Seapark” (CHAR)
SQL> DEFINE
DEFINE _SQLPLUS_RELEASE = “801050000” (CHAR)
DEFINE _EDITOR = “Notepad” (CHAR)
DEFINE _O_RELEASE = “801050000” (CHAR)
DEFINE X = “Seapark” (CHAR)

Using DEFINE with just a variable name causes SQL*Plus to display the value of the
named variable. Using DEFINE by itself causes SQL*Plus to display the value of all
user variables.

DEL
The DEL command deletes one or more lines from the SQL buffer. Following is its
syntax:

DEL [{beg|*|LAST}[ {end|*|LAST}]]

The syntax elements are as follows:

beg The line number of the first line that you want to delete.
end The line number of the last line that you want to delete.
* The currently selected line. This may be used for either the
beginning or end of the range.
LAST The last line in the buffer.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1028

1028 Appendixes

The example in Listing C-8 shows various ways to use the DEL command.

Listing C-8: Using the DEL command


SQL> L
1 SELECT id_no,
2 animal_name,
3 tank_no,
4 birth_date
5 FROM aquatic_animal
6* ORDER BY id_no
SQL> DEL 2 4
SQL> L
1 SELECT id_no,
2 FROM aquatic_animal
3* ORDER BY id_no
SQL> DEL *
SQL> L
1 SELECT id_no,
2* FROM aquatic_animal

The first delete gets rid of lines 2 through 4. The second delete gets rid of the
current line, which happens to be the last line.

DESCRIBE
The DESCRIBE command displays information about the columns in a table.
Following is its syntax:

DESC[RIBE] [schema.]object[@dblink]

The syntax elements are as follows:

schema The schema in which the object is stored. This is optional.


object The name of an object. You can describe tables, object types,
and packages.
dbline A database link.

The following example shows the DESCRIBE command being used to display the
structure of a table:

SQL> DESCRIBE AQUATIC_ANIMAL

Name Null? Type


--------------------------- -------- -------------
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1029

Appendix C ✦ SQL*Plus Reference 1029

ID_NO NOT NULL NUMBER(10)


TANK_NO NUMBER(10)
ANIMAL_NAME VARCHAR2(30)
MARKINGS_DESCRIPTION VARCHAR2(30)
BIRTH_DATE DATE
DEATH_DATE DATE

DISCONNECT
The DISCONNECT command disconnects you from a database. Following is its
syntax:

DISC[CONNECT]

There are no parameters for this command. The DISCONNECT command is used as
follows:

SQL> DISCONNECT
Disconnected from Oracle8i Release 8.1.5.0.0 - Production
With the Partitioning and Java options
PL/SQL Release 8.1.5.0.0 - Production

EDIT
The EDIT command invokes an external text editor and allows you to use it to edit
the contents of the SQL buffer. The EDIT command also allows you to edit the
contents of a text file. Following is its syntax:

ED[IT] [filename]

The syntax element is as follows:

filename The name of an existing file. If you pass a file name as a


parameter, the contents of that file will be loaded into the
editor. Otherwise, the contents of the SQL buffer will be
loaded into the editor.

The EDIT command is invoked as follows:

SQL> EDIT

In most environments, this results in the full screen editor being invoked that
operates outside the bounds of the SQL*Plus session.

Note You can specify the editor to be invoked by defining a user variable named
EDITOR. SQL*Plus invokes the editor that the EDITOR user variable points to. For
example, to have SQL*Plus invoke the vi editor, execute the command DEFINE
EDITOR=vi.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1030

1030 Appendixes

EXECUTE
The EXECUTE command allows you to execute a single PL/SQL statement. Following
is its syntax:

EXEC[UTE] statement

The syntax element is as follows:

statement The PL/SQL statement that you want to execute

The following example illustrates how you can use the EXECUTE command:

SQL> EXECUTE DBMS_OUTPUT.PUT_LINE(‘Hello World’);


Hello World

PL/SQL procedure successfully completed.

EXIT
The EXIT command terminates your SQL*Plus session. Following is its syntax:

EXIT [SUCCESS|FAILURE|WARNING|number|user_var|:bind_var]
[COMMIT|ROLLBACK]

The syntax elements are as follows:

SUCCESS Exits with a status of success. This is the default.


FAILURE Exits with a failure status.
WARNING Exits with a warning status.
number Exits with the specified error code.
user_var Exits and returns the value of the specified user variable as
the status code.
:bind_var Exits and returns the value of the specified bind variable as
the status code.

The following example illustrates how to use the EXIT command:

SQL> EXIT

GET
The GET command loads the contents of a text file into the SQL buffer. Following is
its syntax:

GET filename [LIS[T]|NOL[IST]]


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1031

Appendix C ✦ SQL*Plus Reference 1031

The syntax elements are as follows:

filename Specifies the file that you want to load.


LIST Displays the file on the screen after loading. This is the default.
NOLIST Loads, but doesn’t display, the file.

The following example illustrates how to use the GET command:

SQL> GET from_dual


1* SELECT USER FROM dual

You can use the SAVE command to write the contents of the buffer to a file.

HELP
In some environments, the HELP command will get you help on SQL*Plus
commands. For this to work, you must also install the SQL*Plus help tables in your
database. Following is the HELP command’s syntax:

HELP topic_name

The syntax element is as follows:

topic_name The name of a help topic. Each of the SQL*Plus commands


is a help topic.

The following example illustrates how to use the HELP command:

SQL> HELP COMPUTE

Note The HELP command isn’t available from the Windows NT version of SQL*Plus.

HOST
The HOST command allows you to execute an operating system command from
within SQL*Plus. Following is its syntax:

HO[ST] [command]

The syntax element is as follows:

command The command that you want to execute


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1032

1032 Appendixes

Listing C-9 illustrates how to use the HOST command.

Listing C-9: Using the HOST command


SQL> host time
The current time is: 22:20:22.78
Enter the new time:

SQL> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.

C:\> dir about.html


Volume in drive C has no label.
Volume Serial Number is 07CF-060A

Directory of C:\

10/03/99 09:59p 929 about.html


1 File(s) 929 bytes
455,639,040 bytes free

C:\> exit

INPUT
The INPUT command allows you to add one or more new lines of text to the SQL
buffer. The lines are added following the current line. Following is its syntax:

I[NPUT] [text]

The syntax element is as follows:

text A line that you want to insert. If you supply this argument, then
only this one line is inserted. Otherwise, you may insert as many
lines as you like.

The following example illustrates how to use the INPUT command:

SQL> L
1 SELECT animal_name
2* ORDER BY animal_name
SQL> 1
1* SELECT animal_name
SQL> I
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1033

Appendix C ✦ SQL*Plus Reference 1033

2i FROM aquatic_animal
3i
SQL> L
1 SELECT animal_name
2 FROM aquatic_animal
3* ORDER BY animal_name

LIST
The LIST command lists all or part of the SQL buffer. Following is its syntax:

L[IST] [{beg|*|LAST}[ {end|*|LAST}]]

The syntax elements are as follows:


beg Represents the number of the first line that you want to list
end Represents the number of the last line that you want to list
* Represents the current line and may be used to denote either the
first or last line to list
LAST Represents the last line in the buffer

The following examples illustrate how to use the LIST command:

SQL> L 2 3
2 animal_name
3* FROM aquatic_animal
SQL> L
1 SELECT id_no,
2 animal_name
3 FROM aquatic_animal
4* ORDER BY animal_name

The LIST command with no arguments causes SQL*Plus to display all lines in the
buffer.

PASSWORD
The PASSWORD command allows you to change your Oracle password. It also allows
you to change the password of another user, but only if you have the ALTER USER
system privilege. Following is its syntax:

PASSW[ORD] [username]

The syntax element is as follows:

username The name of the user whose password you want to change
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1034

1034 Appendixes

When you issue the PASSWORD command, SQL*Plus will prompt you for the new
password. For example:

SQL> PASSWORD
Changing password for SEAPARK
Old password: *******
New password: ******
Retype new password: ******
Password changed

PAUSE
The PAUSE command displays a line of text and waits for you to press the Enter key.
Following is its syntax:

PAU[SE] text

The syntax element is as follows:

text The text that you want to display

The following example shows you how to use the PAUSE command:

SQL> PAUSE Press ENTER to begin deleting old data.


Press ENTER to begin deleting old data.

You can use the PAUSE command in scripts as a way to let the user know what’s
going to happen next.

PRINT
The PRINT command displays the contents of a bind variable. The PRINT command
with no arguments displays the contents of all bind variables. Following is its
syntax:

PRI[NT] [variable [variable ...]]

The syntax element is as follows:


variable The name of a bind variable that you want to display

The following example shows a bind variable being declared, initialized with data,
and then displayed using the PRINT command:

SQL> VARIABLE X number


SQL> EXECUTE :x := 11
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1035

Appendix C ✦ SQL*Plus Reference 1035

PL/SQL procedure successfully completed.

SQL> PRINT x

X
---------
11

PROMPT
The PROMPT command displays a line of text on the screen. Following is its syntax:

PRO[MPT] text

The syntax element is as follows:

text The text that you want to display

The following example illustrates how to use the PROMPT command:

SQL> PROMPT Generating the animal report...


Generating the animal report...

QUIT
See the EXIT command. QUIT is synonymous with EXIT.

RECOVER
The RECOVER command is used to initiate database recovery. Its syntax is shown in
Listing C-10.

Listing C-10: The RECOVER command’s syntax


RECOVER [DATABASE [[UNTIL
{CANCEL
|CHANGE scn
|TIME date_time}
[USING BACKUP CONTROLFILE]
[PARALLEL([DEGREE {num_procs|DEFAULT}
|INSTANCES {num_inst|DEFAULT}]...)
|NOPARALLEL]
|TABLESPACE tablespace_name [,tablespace_name...]
[PARALLEL([DEGREE {num_procs|DEFAULT}
|INSTANCES {num_inst|DEFAULT}]...)

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1036

1036 Appendixes

Listing C-10: (continued)


|NOPARALLEL]
|DATAFILE datafile_name [,datafile_name...]
[PARALLEL([DEGREE {num_procs|DEFAULT}
|INSTANCES {num_inst|DEFAULT}]...)
|NOPARALLEL]

The syntax elements are as follows:

RECOVER DATABASE Initiates media recovery on the entire


database
RECOVER TABLESPACE Initiates media recovery on the specified
tablespace_name tablespace or tablespaces. You can
recover up to 16 tablespaces with one
command.
RECOVER DATAFILE Initiates media recovery on the specified
datafile_name datafile or datafiles.
UNTIL CANCEL Gives you the opportunity to cancel
recovery after each log file is processed.
UNTIL CHANGE scn Recovers changes up to, but not
including, the specified system change
number (SCN).
UNTIL TIME date_time Recovers changes committed prior to
the specified date and time.
USING BACKUP CONTROLFILE Recovers using a backup control file.
PARALLEL Causes the recovery to be done in
parallel.
NOPARALLEL Prevents recovery from being done in
parallel.
DEGREE {num_procs|DEFAULT} Controls the degree of parallelism if
PARALLEL is being used.
INSTANCES Specifies the number of instances to use
{num_procs|DEFAULT} in the recovery process. Applicable only
if PARALLEL is specified.

The following example illustrates how to use the RECOVER command:

SQL> RECOVER TABLESPACE seapark_tables;


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1037

Appendix C ✦ SQL*Plus Reference 1037

REMARK
The REMARK command allows you to embed comments within a SQL*Plus script.
Following is its syntax:

REM[ARK] [comment]

The syntax element is as follows:

comment Commentary on the script

The following example illustrates how to use the REMARK command:

SQL> REM This script generates an animal report.


SQL>

Note You can also add comments to scripts by using the double-hyphen (--) or by
using /*...*/.

REPFOOTER
The REPFOOTER command allows you to define a report footer that prints on the
last page of a report. Following is its syntax:

REPF[OOTER] [printspec [text|user_var]... [printspec...]]


|[OFF|ON]

printspec := {COL col_num


|S[KIP] lines
|TAB col_num
|LE[FT]
|CE[NTER]
|R[IGHT]
|BOLD
|FORMAT format}

The syntax elements are as follows:

text Specifies text that you want to appear as part of the


report footer.
user_var Identifies a user variable, the contents of which will
appear in the title. This may also be one of the following
predefined user variables: SQL.LNO for the current line
number, SQL.PNO for the current page number,
SQL.RELEASE for the current Oracle release number,
SQL.SQLCODE for the current error number, and
SQL.USER for the current username.
COL col_num Indents to the specified column.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1038

1038 Appendixes

SKIP lines Skips the specified number of lines.


LEFT Causes subsequent text to appear left-justified in the
current line.
CENTER Causes subsequent text to appear centered in the
current line. Note that the definition of center is
controlled by the SET LINESIZE command.
RIGHT Causes subsequent text to appear flush right. Note that
the SET LINESIZE command also defines the right
edge of the line.
BOLD Causes text to be printed three times in succession, on
three different lines.
FORMAT format Specifies a display format to use for subsequent text or
numeric values. See the section early in this chapter
titled “SQL*Plus Display Formats” for details on
specifying format strings.
OFF Turns the report footer off.
ON Turns the report footer on.

The following example illustrates how to use the REPFOOTER command:

SQL> REPFOOTER CENTER “End of Report”


SQL> SELECT * FROM DUAL;

D
-
X
End of Report

Note The report footer will actually print just prior to the final page footer (BTITLE) for
the report.

REPHEADER
The REPHEADER command allows you to define a report header that prints on the
first page of a report. Following is its syntax:

REPH[HEADER] [printspec [text|user_var]... [printspec...]]


|[OFF|ON]

printspec := {COL col_num


|S[KIP] lines
|TAB col_num
|LE[FT]
|CE[NTER]
|R[IGHT]
|BOLD
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1039

Appendix C ✦ SQL*Plus Reference 1039

|FORMAT format}

The syntax elements are as follows:

text Specifies text that you want to appear as part of the


report header.
user_var Identifies a user variable, the contents of which will
appear in the title. This may also be one of the following
predefined user variables: SQL.LNO for the current line
number, SQL.PNO for the current page number,
SQL.RELEASE for the current Oracle release number,
SQL.SQLCODE for the current error number, and
SQL.USER for the current username.
COL col_num Indents to the specified column.
SKIP lines Skips the specified number of lines.
LEFT Causes subsequent text to appear left-justified in the
current line.
CENTER Causes subsequent text to appear centered in the
current line. Note that the definition of center is
controlled by the SET LINESIZE command.
RIGHT Causes subsequent text to appear flush right. Note that
the SET LINESIZE command also defines the right edge
of the line.
BOLD Causes text to be printed three times in succession, on
three different lines.
FORMAT format Specifies a display format to use for subsequent text or
numeric values. See the section early in this chapter
titled “SQL*Plus Display Formats” for details on
specifying format strings.
OFF Turns the report header off.
ON Turns the report header on.

The following example illustrates how to use the REPHEADER command:

SQL> REPHEADER CENTER “The Seapark Animal Report” SKIP 2


SQL> SELECT animal_name FROM aquatic_animal;

The Seapark Animal Report

ANIMAL_NAME
------------------------------
Flipper
Skipper
Bopper
End of Report
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1040

1040 Appendixes

Note The report header will print just after the first page header (TTITLE).

RUN
The RUN command lists and executes the SQL statement or PL/SQL block currently
in the SQL buffer. Following is its syntax:

R[UN]

This command has no parameters. The following example illustrates the use of the
RUN command:

SQL> L
1 SELECT USER
2* FROM dual
SQL> R
1 SELECT USER
2* FROM dual

USER
------------------------------
SEAPARK

SAVE
The SAVE command writes the contents of the SQL buffer to a file. Following is its
syntax:

SAV[E] filename [CRE[ATE]|REP[LACE]|APP[END]

The syntax elements are as follows:

filename Specifies the name of the file to which you want to write the
contents of the SQL buffer. The default extension is .sql.
CREATE Creates a new file and causes the command to fail if the file
already exists.
REPLACE Creates a new file or replaces the file if it already exists.
APPEND Appends the buffer contents to the end of the file.

The following example illustrates how to use the SAVE command:

SQL> SELECT animal_name


2 FROM aquatic_animal
3
SQL> SAVE c:\a\list_animals CREATE
Created file c:\a\list_animals
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1041

Appendix C ✦ SQL*Plus Reference 1041

You can find the SQL statement in the file named list_animals.sql in the c:\a
directory.

SET
The SET command changes a setting that controls how SQL*Plus operates. A large
number of settings have been added over the years that allow you to closely
control certain aspects of SQL*Plus’ behavior. Its syntax is shown in Listing C-11.

Listing C-11: The SET command’s syntax


SET APPI[NFO] {OFF|ON|app_text}
ARRAY[SIZE] array_size
AUTO[COMMIT] {OFF|ON|IMMEDIATE|statement_count}
AUTOP[RINT] {OFF|ON}
AUTORECOVERY {OFF|ON}
AUTOT[RACE] {OFF|ON|TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]]
BLO[CKTERMINATOR] block_term
BUF[FER] {buffer_name|SQL}
CLOSECUR[SOR] {OFF|ON}
CMDS[EP] {OFF|ON|separator
COLSEP column_separator
COM[PATIBILITY] {V7|V8|NATIVE}
CON[CAT] {OFF|ON|concat}
COPYC[OMMIT] batch_count
COPYTYPECHECK {OFF|ON}
DEF[INE] {OFF|ON|prefix}
DOC[UMENT] {ON|OFF}
ECHO {OFF|ON}
EDITF[ILE] editfile
EMB[EDDED] {ON|OFF}
ESC[APE] {OFF|ON|escape}
FEED[BACK] {OFF|ON|row_threshold}
FLAGGER {OFF|ENTRY|INTERMED[IATE]|FULL}
FLU[SH] {OFF|ON}
HEA[DING] [ON|OFF]
HEADS[EP] heading_separator
INSTANCE [service_name|LOCAL]
LIN[ESIZE] line_width
LOBOF[FSET] offset
LOGSOURCE logpath
LONG long_length
LONGC[HUNKSIZE] size
MAXD[ATA] max_row_width
NEWP[AGE] {lines_to_print|NONE}
NULL null_text
NUMF[ORMAT] format
NUM[WIDTH] width

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1042

1042 Appendixes

Listing C-11: (continued)


PAGES[IZE] lines_per_page
PAU[SE] {ON|OFF|pause_message}
RECSEP {WR[APPED]|EA[CH]|OFF}
RECSEPCHAR separator
SCAN {OFF|ON}
SERVEROUT[PUT] {OFF|ON}
[SIZE buffer_size]
[FOR[MAT]
{WRA[PPED]|WOR[D_WRAPPED]|TRU[NCATED]}
SHIFT[INOUT] {VIS[IBLE]|INV[ISIBLE]}
SHOW[MODE] {ON|OFF|BOTH}
SPACE num_spaces
SQLBLANKLINES {OFF|ON}
SQLC[ASE] {MIXED|UPPER|LOWER}
SQLCO[NTINUE] continuation
SQLN[UMBER] {OFF|ON}
SQLPRE[FIX] prefix
SQLP[ROMPT] prompt
SQLT[ERMINATOR] {OFF|ON|term}
SUF[FIX] extension
TAB {OFF|ON}
TERM[OUT] {OFF|ON}
TI[ME] {OFF|ON}
TIMI[NG] {OFF|ON}
TRIM[OUT] {ON|OFF}
TRIMS[POOL] {ON|OFF}
TRU[NCATE] {OFF|ON}
UND[ERLINE] {underline | {ON|OFF}}
VER[IFY] {OFF|ON}
WRA[P] {ON|OFF}

The syntax elements for the SET command are shown in Table C-3.

Table C-3
Syntax Elements for the SET Command
Element Description

APPI[NFO] {OFF|ON|app_text} Enables and disables the automatic


registration of command files. The
app_text argument allows you to specify
the registration text to use when no
command file is being run.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1043

Appendix C ✦ SQL*Plus Reference 1043

Element Description

ARRAY[SIZE] array_size Specifies the number of rows in a batch. A


batch represents the number of rows that
SQL*Plus will retrieve with each fetch from
the database.
AUTO[COMMIT] {OFF|ON|IMMEDIATE| Controls whether statements are
statement_count}automatically
committed after they are executed. OFF
is the default; ON and IMMEDIATE both
cause SQL*Plus to automatically commit
each of your SQL statements. By supplying
a statement_count value, you can have
SQL*Plus commit each time that a
specified number of statements have been
executed.
AUTOP[RINT] {OFF|ON} Enables or disables the automatic printing
of SQL*Plus bind variables after each SQL
statement execution.
AUTORECOVERY {OFF|ON} Enables or disables automatic recovery.
AUTOT[RACE] {OFF|ON|TRACE[ONLY]} Controls the SQL*Plus autotrace
[EXP[LAIN]] [STAT[ISTICS]] functionality. Turning autotrace on causes
SQL*Plus to gather and display statistics
about each SQL statement executed. The
EXPLAIN option causes SQL*Plus to show
the execution plan. The STATISTICS
option causes SQL*Plus to show statistics.
The TRACEONLY option causes SQL*Plus
to show the statistics and the plan, but not
the actual data returned by the statement.
BLO[CKTERMINATOR] block_term Specifies the character used to terminate a
PL/SQL block without executing it. The
default value is a period.
BUF[FER] {buffer_name|SQL} Allows you to switch between buffers.
CMDS[EP] {OFF|ON|separator Controls whether you can enter multiple
SQL*Plus commands on one line, and also
specifies the separator character that goes
between those commands. The default
behavior is not to allow multiple
commands on one line.
COLSEP column_separator Specifies the separator character to use
between columns of SQL*Plus output. The
default value is a space.

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1044

1044 Appendixes

Table C-3 (continued)


Element Description

COM[PATIBILITY] {V7|V8|NATIVE} Specifies the release of Oracle that


SQL*Plus needs to be compatible with. The
default value is NATIVE, which means that
the database determines the setting.
CON[CAT] {OFF|ON|concat} Specifies the character that you use to
terminate a SQL*Plus user variable name.
The default is a period.
COPYC[OMMIT] batch_count Specifies the number of batches that
SQL*Plus will write during the execution of
a COPY command before executing a
COMMIT. The default value is 0, meaning
that one COMMIT is done when the COPY
command finishes.
COPYTYPECHECK {OFF|ON} Allows you to suppress type checking when
the COPY command is being used. The
default value is ON.
DEF[INE] {OFF|ON|prefix} Specifies the prefix character used to
identify user variables and also allows you
to enable or disable the recognition of
those variables. The default prefix character
is the ampersand (&).
ECHO {OFF|ON} Enables or disables the echoing of
commands as they are executed from a
script file. The default is OFF.
EDITF[ILE] editfile Allows you to specify the name used for
the temporary work file created when you
issue the EDIT command. The default file
name is afiedt.buf.
EMB[EDDED] {ON|OFF} Allows you to embed two reports on one
page. The default setting, OFF, forces each
new report to start on a new page. The ON
setting inhibits the page break between
reports.
ESC[APE] {OFF|ON|escape} Defines the SQL*Plus escape character and
also allows you to enable or disable
recognition of that character.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1045

Appendix C ✦ SQL*Plus Reference 1045

Element Description

FEED[BACK] Controls whether you see feedback after


{OFF|ON|row_threshold} issuing a SQL statement. By default,
feedback is on and occurs whenever a
statement affects at least six rows.
FLAGGER {OFF|ENTRY| Specifies the level of FIPS flagging that
INTERMED[IATE]|FULL} you need. The default setting is OFF.
FLU[SH] {OFF|ON} Controls whether output is displayed
immediately. By default, FLUSH is ON, and
output is displayed immediately. You can
set FLUSH to OFF to have output buffered.
HEA[DING] [ON|OFF] Controls whether column headings print.
The default setting is ON.
HEADS[EP] heading_separator Specifies the separator character used to
divide a column heading into two or more
lines. The default value is a vertical bar (|).
INSTANCE [service_name|LOCAL] Specifies the default instance to use for
your session.
LIN[ESIZE] line_width Specifies the width of a report line in terms
of a number of characters. This setting
affects centering and right justifying of
report text.
LOBOF[FSET] offset Specifies a starting byte position for CLOB
and BLOB columns.
LOGSOURCE logpath Specifies the directory containing your
archived redo logs.
LONG long_length Specifies the number of characters that will
be displayed when a LONG value is
selected. The default is 80.
LONGC[HUNKSIZE] size Specifies the chunk size that SQL*Plus uses
when retrieving a LONG value.
NEWP[AGE] {lines_to_print|NONE} Specifies the number of blank lines to print
to advance to a new page. The default
value is 1. A value of 0 results in a
formfeed character being printed.
NULL null_text Specifies the text to display in place of a
null column value. The default is to display
blanks.

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1046

1046 Appendixes

Table C-3 (continued)


Element Description

NUMF[ORMAT] format Specifies a default number display format.


NUM[WIDTH] width Specifies a default number display width.
The default width is ten characters.
PAGES[IZE] lines_per_page Specifies the number of lines on a page.
The default setting is 24 lines.
PAU[SE] {ON|OFF|pause_message} Enables or disables the pausing of output
after each page of a report. Also allows you
to define a message that is displayed when
a pause occurs.
RECSEP {WR[APPED]|EA[CH]|OFF} Specifies when record separators are
displayed between two records in a report.
The default setting is WRAPPED and results
in a separator line only when one or more
column values wraps to a second line. The
EACH option causes a record separator to
be displayed after each line. The OFF
option turns off the record separator
feature completely.
RECSEPCHAR separator Specifies the character to use for the record
separator. The default value is a hyphen (-).
SCAN {OFF|ON} Enables or disables scanning for SQL*Plus
user variables.
SERVEROUT[PUT] {OFF|ON} Enables or disables the display of output
[SIZE buffer_size] from a PL/SQL block. Allows you to specify
[FOR[MAT] {WRA[PPED] the size of the buffer used to hold that
output. Allows you to control whether the
|WOR[D_WRAPPED]|TRU[NCATED]} output is wrapped, word-wrapped, or
truncated to match the line size.
SHIFT[INOUT] {VIS[IBLE]| Controls whether shift characters are
INV[ISIBLE]} visible. This setting applies only when an
IBM 3270 terminal is being used. The
default setting is INVISIBLE.
SHOW[MODE] {ON|OFF|BOTH} Controls whether SQL*Plus displays the old
and new values of a setting when you
change it. The default setting is OFF. The
ON setting enables this behavior. BOTH
performs the same task as ON.
SQLBLANKLINES {OFF|ON} Controls whether blank lines are allowed
within SQL statements. The default setting
is OFF.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1047

Appendix C ✦ SQL*Plus Reference 1047

Element Description

SQLC[ASE] {MIXED|UPPER|LOWER} Controls whether the case of SQL


statements is adjusted before being sent to
the Oracle server. The default setting is
MIXED, which means that SQL statements
are left unchanged. The UPPER setting
causes SQL*Plus to uppercase everything.
The LOWER setting causes SQL*Plus to
lowercase each statement.
SQLCO[NTINUE] continuation Specifies the continuation character to use
for long SQL*Plus commands. The default
is a hyphen (-).
SQLN[UMBER] {OFF|ON} Controls whether numeric prompts are
used for the second and subsequent lines
of a multiline SQL statement. The default
setting is ON.
SQLPRE[FIX] prefix Specifies the SQL*Plus prefix character,
which allows you to execute SQL*Plus
commands while entering a long SQL
statement. Just place the command on a
line by itself and prefix it with the prefix
character. The default prefix character is the
number sign (#).
SQLP[ROMPT] prompt Specifies the prompt to use. The default
value is SQL>.
SQLT[ERMINATOR] {OFF|ON|term} Specifies the character used to terminate
and execute SQL statements, and controls
whether that character is recognized by
SQL*Plus. The default terminator character
is a semicolon (;).
SUF[FIX] extension Specifies the default file extension used for
the GET, SAVE, EDIT, @, and @@
commands. The default value is .sql.
TAB {OFF|ON} Controls whether SQL*Plus uses tab
characters to format white space when
outputting to the display. The default
setting is ON.
TERM[OUT] {OFF|ON} Controls whether SQL*Plus displays output
on the screen. The default setting is ON.
The OFF setting is respected only when
commands are being executed from a
script file.

Continued
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1048

1048 Appendixes

Table C-3 (continued)


Element Description

TI[ME] {OFF|ON} Specifies whether the date and time are


displayed as part of each prompt. The
default setting is OFF.
TIMI[NG] {OFF|ON} Controls whether timing statistics are
displayed for each SQL statement that is
executed. The default setting is OFF.
TRIM[OUT] {ON|OFF} Controls whether trailing spaces are
removed from the output. The default
setting is ON.
TRIMS[POOL] {ON|OFF} Controls whether trailing spaces are
removed from the output before it is
written to a spool file. The default setting
is OFF.
UND[ERLINE] {underline | Specifies the character used to underline
{ON|OFF}} column headings, and controls whether
that underlining occurs. The default
underline character is a hyphen (-).
VER[IFY] {OFF|ON} Controls whether before and after images
are displayed for lines containing SQL*Plus
user variables. The default setting is ON.
WRA[P] {ON|OFF} Controls whether SQL*Plus wraps long
lines of output. The default setting is ON.

The following example illustrates how to use the SET command:

SQL> SET LINESIZE 80


SQL> SET PAGESIZE 50

SHOW
The SHOW command displays the current value of a SQL*Plus setting. Following is
its syntax:

SHO[W] [option|ALL]

The syntax elements are as follows:

option Any setting that you can set using the SET command
ALL A keyword causing SQL*Plus to list the values of all settings
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1049

Appendix C ✦ SQL*Plus Reference 1049

The following example illustrates how to use the SHOW command:

SQL> SHOW LINESIZE


linesize 80
SQL> SHOW ALL
appinfo is ON and set to “SQL*Plus”
arraysize 15
autocommit OFF
autoprint OFF
autorecovery OFF
autotrace OFF
...

The first example shows the value of one setting, the LINESIZE setting. The second
example shows the value of all settings. The resulting list is quite long.

SHUTDOWN
The SHUTDOWN command shuts down a database. You must be connected as
INTERNAL, SYSDBA, or SYSOPER to use this command. Following is its syntax:

SHUTDOWN [NORMAL|IMMEDIATE|TRANSACTIONAL|ABORT]

The syntax elements are as follows:

NORMAL Performs a normal shutdown, allowing users to


disconnect when they are ready. This is the default
behavior.
IMMEDIATE Performs an immediate shutdown, forcibly disconnecting
users as soon as they have completed their current
statement.
TRANSACTIONAL Performs a transactional shutdown, forcibly
disconnecting users as soon as they have completed
their current transaction.
ABORT Aborts the instance. All processes are stopped
immediately.

The following example illustrates how to use the SHUTDOWN command:

SQL> CONNECT system/manager AS SYSDBA


Connected.
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1050

1050 Appendixes

SPOOL
The SPOOL command allows you to send SQL*Plus output to a file. Following is its
syntax:

SPO[OL] [filename|OFF|OUT]

The syntax elements are as follows:

filename Specifies the name of the file to which you want to write
the output. Spooling starts immediately after you issue a
command specifying a spool file name. The default file
extension is operating-system-specific, but it is usually
.lis or .lst.
OFF Stops the writing of output to the spool file and closes the file.
OUT Does the same thing as OFF, but also prints the file. However,
in Windows environments, this option functions exactly
like OFF.

The following example illustrates how to use the SHUTDOWN command:

SQL> SPOOL
not spooling currently
SQL> SPOOL c:\a\animal_report

Issuing the SPOOL command with no arguments, as done in the first instance here,
causes the current state of spooling to be displayed.

START
The START command executes a SQL*Plus script file. This command functions the
same as the @ command. Following is its syntax:

STA[RT] filename [arg [arg...]]

The syntax elements are as follows:

filename The name of the file that you want to execute. The default
extension is .sql.
arg A command-line argument that you want to pass to the file.

The following example illustrates the use of the START command:

SQL> START create_user


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1051

Appendix C ✦ SQL*Plus Reference 1051

STARTUP
The STARTUP command allows you to start an instance and open a database. You
must be connected as INTERNAL, SYSDBA, or SYSOPER to use this command.
Following is its syntax:

STARTUP [FORCE] [RESTRICT]


[PFILE=filename]
[MOUNT [OPEN [RECOVER]] [database_name]]
[[EXCLUSIVE|PARALLEL|SHARED] [RETRY]] | [NOMOUNT]

The syntax elements are as follows:

FORCE Forces an instance to start. If the instance is running, a


SHUTDOWN ABORT is done first, thus ensuring that a
startup occurs.
RESTRICT Opens the database in restricted session mode.
PFILE=filename Tells SQL*Plus to use the specified parameter file when
starting the instance. If you don’t specify this
parameter, Oracle will use the default parameter file
name for your platform. See Chapter3, “Oracle8i
Architecture,” for information on parameter files.
MOUNT Causes SQL*Plus to mount the database but not to
open it.
OPEN Opens the database for normal operation.
RECOVER Causes Oracle to perform media recovery if necessary
and then open the database.
database_name Allows you to override the value of the DB_NAME
parameter in the initialization file.
EXCLUSIVE Opens the database for exclusive use by the instance
being started.
PARALLEL Opens the database such that multiple instances can
access it.
SHARED Causes the same behavior as PARALLEL.
RETRY Causes SQL*Plus to keep retrying if it fails to open the
database on the first try.
NOMOUNT Starts an instance but doesn’t mount or open a
database.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1052

1052 Appendixes

The following example illustrates how to use the STARTUP command:

SQL> CONNECT SYSTEM/MANAGER AS SYSDBA


Connected to an idle instance.
SQL> STARTUP
ORACLE instance started.

Total System Global Area 38322124 bytes


Fixed Size 65484 bytes
Variable Size 21405696 bytes
Database Buffers 16777216 bytes
Redo Buffers 73728 bytes
Database mounted.
Database opened.

STORE
The STORE command generates a text file with SET commands reflecting the current
SQL*Plus settings. Following is its syntax:

STORE SET filename [CRE[ATE]|REP[LACE]|APP[END]]

The syntax elements are as follows:

filename Specifies the name of the file to which you want to write the
SET commands
CREATE Creates a new file and returns an error if the file already exists
REPLACE Replaces an existing file and creates a new one if necessary
APPEND Appends commands onto the end of an existing file

The following example illustrates how to use of the STORE command:

SQL> STORE SET c:\a\settings.sql


Created file c:\a\settings.sql

The file c:\a\settings.sql now contains all the SET commands necessary to
reset the SQL*Plus environment to its current state. You can change those settings
and revert back later by using the @ command to execute the file.

TIMING
Allows you to start and stop a SQL*Plus timer. Following is its syntax:

TIMI[NG] [START [timer_name ] | SHOW | STOP]


4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1053

Appendix C ✦ SQL*Plus Reference 1053

The syntax elements are as follows:

START [timer_name] Starts a new timer. You may optionally provide a


name for the timer so that you can reference it
later.
SHOW Displays the elapsed time from the most recently
started timer.
STOP Stops the most recently started timer, displays its
current elapsed time value, and then deletes it.

Note Using the TIMING command with no parameters causes SQL*Plus to display the
number of active timers.

The following example illustrates the use of the TIMING command:

SQL> TIMING START egg_timer


SQL> TIMING SHOW
timing for: egg_timer
real: 3856
SQL> TIMING STOP
timing for: egg_timer
real: 7421
SQL>

The format for the elapsed time is platform-specific. On Windows platforms, the
elapsed time is displayed in milliseconds. On most UNIX platforms, it’s displayed in
minutes and seconds.

TTITLE
The TTITLE command defines a header (top title) that appears at the top of each
page of a report. Following is its syntax:

TTI[TLE] [printspec [text|user_var]... [printspec...]]


|[OFF|ON]

printspec := {COL col_num


|S[KIP] lines
|TAB col_num
|LE[FT]
|CE[NTER]
|R[IGHT]
|BOLD
|FORMAT format}
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1054

1054 Appendixes

The syntax elements are as follows:

text Specifies text that you want to appear as part of the title.
user_var Specifies a user variable, the contents of which will
appear in the title. This may also be one of the following
predefined user variables: SQL.LNO for the current line
number, SQL.PNO for the current page number,
SQL.RELEASE for the current Oracle release number,
SQL.SQLCODE for the current error number, and
SQL.USER for the current username.
COL col_num Indents to the specified column.
SKIP lines Skips the specified number of lines.
LEFT Causes subsequent text to appear left-justified in the
current line.
CENTER Causes subsequent text to appear centered in the
current line. Note that the definition of center is
controlled by the SET LINESIZE command.
RIGHT Causes subsequent text to appear flush right. Note that
the SET LINESIZE command also defines the right edge
of the line.
BOLD Causes text to be printed three times in succession, on
three different lines.
FORMAT format Specifies a display format to use for subsequent text or
numeric values. See the section early in this chapter
titled “SQL*Plus Display Formats” for details on
specifying format strings.
OFF Turns the page header off.
ON Turns the page header on.

The following setting defines a two-line page header:

SQL> TTITLE CENTER “Animal Listing” SKIP 1 -


> FORMAT 999 CENTER “Page “ sql.pno

Assuming a 50-character-wide line, this footer will display as follows:

Animal Listing
Page 1
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1055

Appendix C ✦ SQL*Plus Reference 1055

You can use the TTITLE command with no arguments to see the current title
setting, as shown in the following example:

SQL> TTITLE
ttitle ON and is the following 72 characters:
CENTER “Animal Listing” SKIP 1 FORMAT 999 CENTER “Page “ sql.pno

UNDEFINE
The UNDEFINE command undefines a SQL*Plus user variable. Following is its
syntax:

UNDEF[INE] variable

The syntax elements are as follows:

variable The name of the user variable that you want to undefine

The following example illustrates the use of the DEFINE command:

SQL> DEFINE X = “Y”


SQL> DEFINE X
DEFINE X = “Y” (CHAR)
SQL> UNDEFINE X
SQL> DEFINE X
SP2-0135: symbol x is UNDEFINED

In this example, the variable X was defined, displayed, and then undefined. When
another attempt was made to display the value of X, an error message was
returned.

VARIABLE
The VARIABLE command defines a SQL*Plus bind variable. Following is its syntax:

VAR[IABLE] variable data_type

The syntax elements are as follows:

variable The name of the bind variable that you want to define.
data_type One of the following datatypes: NUMBER, CHAR, VARCHAR2,
NCHAR, NVARCHAR2, CLOB, NCLOB, and BLOB. You may specify a
length for the character string variables, but not for NUMBER
and not for the LOB types.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1056

1056 Appendixes

The following example illustrates the use of the VARIABLE command:

SQL> VARIABLE x NUMBER


SQL> VARIABLE y VARCHAR2(30)
SQL> VARIABLE z CLOB

In this example, X is a number, Y is a variable-length character string, and Z is a


character-large object. The maximum string length that Y can handle is 30 bytes.

WHENEVER OSERROR
The WHENEVER OSERROR command allows you to specify an action to take in the
event that an operating system error occurs. Following is its syntax:

WHENEVER OSERROR
{EXIT [SUCCESS|FAILURE|value|:bind_variable|]
[COMMIT|ROLLBACK]
|CONTINUE [COMMIT|ROLLBACK|NONE]}

The syntax elements are as follows:

EXIT SUCCESS Exit with a success status.


EXIT FAILURE Exit with a failure status.
EXIT value Exit and return the value specified as the status.
EXIT :bind_variable Exit and return the value of the specified bind
variable as the status.
CONTINUE Do not exit if an error occurs. This is the default
behavior.
COMMIT Causes SQL*Plus to automatically commit the
current transaction when an error occurs. This is
the default behavior.
ROLLBACK Causes SQL*Plus to roll back the current
transaction when an error occurs.
NONE Causes SQL*Plus to neither commit nor roll back
when an error occurs. You can use this only with
CONTINUE.

The following example illustrates the use of the WHENEVER OSERROR command:

SQL> WHENEVER OSERROR EXIT FAILURE

In this example, SQL*Plus will exit when an operating system error occurs, and an
exit status indicating a failure will be returned to the operating system.
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1057

Appendix C ✦ SQL*Plus Reference 1057

WHENEVER SQLERROR
The WHENEVER SQLERROR command allows you to specify an action to take in the
event that a SQL error occurs. Following is its syntax:

WHENEVER SQLERROR
{EXIT [SUCCESS|FAILURE|value|:bind_variable|]
[COMMIT|ROLLBACK]
|CONTINUE [COMMIT|ROLLBACK|NONE]}

The syntax elements are as follows:

EXIT SUCCESS Exit with a success status.


EXIT FAILURE Exit with a failure status.
EXIT value Exit and return the value specified as the status.
EXIT :bind_variable Exit and return the value of the specified bind
variable as the status.
CONTINUE Do not exit if an error occurs. This is the default
behavior.
COMMIT Causes SQL*Plus to automatically commit the
current transaction when an error occurs. This is
the default behavior.
ROLLBACK Causes SQL*Plus to roll back the current
transaction when an error occurs.
NONE Causes SQL*Plus to neither commit nor roll back
when an error occurs. You can use this only with
CONTINUE.

The following example illustrates the use of the WHENEVER SQLERROR command:

SQL> WHENEVER SQLERROR EXIT SUCCESS ROLLBACK

In this example, SQL*Plus will exit when a SQL error occurs. The exit status
returned to the operating system will indicate success, but the transaction will be
rolled back.

✦ ✦ ✦
4623-6 AppC.f.qc 1/28/00 12:37 PM Page 1058

Anda mungkin juga menyukai