Oracle PL/SQL Tutorial/SQL PLUS Session Environment/Introduction — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:04, 26 мая 2010
SQLPLUS commands.
Command Description
! Executes a single host level command (UNIX, NT)
$ Executes a single host level command (OpenVMS)
&(1-n) Substitutes the user inputted variable in position n here
&user_variable Substitutes the user variable here (will prompt for variable if not previously defined or ACCEPTed
. (period) Ends a substitution variable
/ Executes previous SQL command or terminates PL/SQL routine entry
@ On login, used to specify database alias as part of user/password@alias, or, used to automatically start an external routine as a part of user/password@alias @routine, or used to GET and RUN a SQL script if used form the command line in SQLPLUS
ACCEPT Asks for a user variable usually used like: ACCEPT variable PROMPT �Prompt string for variable�
APPEND Appends to the current line in the buffer. This can be shortened to just A or a.
ATTRIBUTE Specifies the display characteristics of a given attribute for an Object Type column, such as the format for NUMBER data. This command can also list current display characteristics for a single attribute or for all attributes of an Object Type.
BREAK Specifies BREAK values for a report output
BTITLE Specifies a report bottom title
CHANGE Replaces specific characters or phrases in the current buffer line. This can be shortened to just C or c.
CLEAR Clears definitions such as COLUMN, BREAK or COMPUTE definitions; also used to clear the screen or the buffer area
COLUMN Sets column formats; can specify HEADING, FORMAT, WORD_WRAP, JUSTIFY, and other column related format issues
COMPUTE Sets computed values such as SUM, AVG, COUNT, on BREAK values
CONNECT Connects to a different database or user
COPY Copies values from one table to another or one database to another; can be used for LONG datatypes
DEFINE Defines variables used in SQL routines
DEL Deletes the current line, a specified single (1�n) line or group (x y z) of lines, or a specified range (x�y) of lines from the buffer
DISCONNECT Disconnects from the current database without exiting SQLPLUS; issues an implicit COMMIT
EDIT (ED) Invokes the default system editor for the lines contained in the SQL buffer�usually Notepad on NT, vi on UNIX, and edt on OpenVMS
EXECUTE Executes a single PL/SQL procedure or function call
EXIT Exits the SQLPLUS executable; issues an implicit COMMIT
GET Gets the specified external file and places it in the buffer without execution of the file
HOST Forks out to the HOST system until an EXIT is issued at the HOST level
INPUT (I) Inputs one line of text at the current location in the SQL buffer
LIST (L) Lists the contents of the SQL buffer
PASSWORD Allows change of the user password without echoing it to the terminal
PAUSE Pauses execution until the Enter key is pressed
PRINT Prints the specified variable value to the screen
PROMPT Prompts with the specified text; expects an Enter key stroke to terminate PROMPT
REMARK (REM) Sets remarks in a SQL script; can also use a double dash
REPFOOTER Set a report footer
REPHEADER Used to specify a report header
RUN Runs the contents of the SQL buffer
SAVE Saves the contents of the SQL buffer to a file
SET Sets various environmental variables such as LINESIZE (width of page), PAGESIZE (number of lines), ECHO (echo all commands to screen), VERIFY (verify substitutions of variables), and FEEDBACK (give messages such as line counts and successful executions)
SPOOL Specifies the output file for script or command output
START Loads and runs a SQL script (identical to the @ command)
STORE Saves the attributes of the current SQLPLUS session in an OS file
TIMING Sets timing on or off for SQL command execution timing
TTITLE Sets a top-title for output
UNDEFINE Undefines a variable
VARIABLE Ses up a variable definition
WHENEVER SQLERROR| Processes errors in the SQL or OS environmentOSERROR
--
SQL*Plus is a tool for interfacing with the Oracle database.
You can use it to
- Execute SQL and PL/SQL in the database
- Update data in your database
- Perform queries on your data
- Format the result sets of those queries into reports
- Create, edit, retrieve, and execute SQL scripts
- Administer the database
29. 1. Introduction 29. 1. 1. SQL*Plus is a tool for interfacing with the Oracle database. 29. 1. 2. <A href="/Tutorial/Oracle/0580__SQL-PLUS-Session-Environment/SQLPLUScommands.htm">SQLPLUS commands.</a>