You can use SQL*Plus commands to
manipulate SQL commands and PL/SQL blocks, and to format and print query
results.
You can continue a long SQL*Plus
command by typing a hyphen (-) at the end of the line and pressing [RETURN]. If
you wish, you can type a space before typing the hyphen. SQL*Plus displays a
right angle-bracket ($>$) as a prompt for each additional line.
You do not need to end a SQL*Plus
command with a semicolon. When you finish entering the command, you can just
press [RETURN].
You can use a number of SQL*Plus
commands to edit the SQL command or PL/SQL block currently stored in the
buffer. Or, you can use a host operating system editor to edit the buffer
contents. SQL*Plus commands are not stored in the buffer; you must edit them at
the prompt or re-enter the command. Here
is few commands,
SQL*Plus
Commands
|
||
COMMAND
|
ABBREVIATION
|
PURPOSE
|
APPEND
|
A text
|
add text at the end of a line
|
CHANGE /old/new
|
C /old/new
|
change old to new in the line
|
CHANGE /text
|
C text
|
delete text from a line
|
CLEAR BUFFER
|
CL BUFF
|
delete all lines
|
DEL
|
(none)
|
delete a line
|
INPUT
|
I
|
add one or more lines
|
INPUT text
|
I text
|
add a line consisting of text
|
LIST
|
L
|
list all lines in the SQL buffer
|
LIST n
|
L n OR n
|
list one line
|
LIST *
|
L *
|
list the current line
|
LIST LAST
|
L LAST
|
list the last line
|
LIST m n
|
L m n
|
list a range of lines (m to n)
|
Once you have modified the buffer
you can use the ``RUN'' command to execute the buffer contents. To save the
contents of the buffer to a text file, use the ``SAVE file\_name'' command.
You can use your host operating
system's default text editor to create and edit host system files and to modify
the SQL*Plus buffer. To invoke the default text editor without leaving SQL*Plus
enter:
SQL> EDIT
EDIT loads the contents of the buffer into your
system's default text editor. When you exit from your text editor, the text is
saved back into the current buffer.
To load the buffer contents into a
text editor other than the default (EDITOR environment variable), use the
SQL*Plus DEFINE command to define a variable, \_EDITOR, to hold the name of the
editor.
SQL> DEFINE_EDITOR = notepad
You can create a command file with a
host operating system text editor by entering EDIT followed by the name of the
file:
SQL> EDIT file_name
EDIT adds the file name extension
``.SQL'' to the name unless you type a period and a different extension at the
end of the file name.
You can retrieve a command file
using the SQL*Plus:
SQL> GET file_name
The START command retrieves a
command file and runs the command(s) it contains. Use START to run a command
file containing SQL commands, PL/SQL blocks, and/or SQL*Plus commands.
SQL> START file_name
You can also use the @(``at'' sign)
command to run a command file. The @ command lists and runs the commands in the
specified command file in the same manner as the START command.
SQL> @file_name
No comments:
Post a Comment