The following commands can be issued in SQL*Plus (in addition to the standardSQL commands.)
@pathname Run (START) an SQL Script
@MyScript.sql parameter1 parameter2 parameter3
In the SQL-Script, refer to the parameters as &1, &2, and &3.
@ScriptName.sql will call sub-scripts from the current working directory of SQL*Plus.
@C:\work\oracle\ScriptName.sql will call a sub-script from a specific directory.
@@pathname Run (START) an SQL Script
@@ will call a sub-script from the same directory as the main script.
@variable A substitution variable
@@variable A substitution variable valid for the session
/ Execute (or re-execute) commands in the SQL*Plus buffer
does not list commands before running
ACCEPT User input
ACC[EPT] variable [NUM[BER]|CHAR|DATE] [FORMAT format]
[DEFAULT default] [PROMPT text|NOPROMPT] [HIDE]
APPEND Add text to the end of the current line in the buffer.
A[PPEND] text_to_add
BREAK Specify where and how formatting will change.
BREAK ON {column|expr|ROW|REPORT} action
BTITLE Place and format a title at the bottom of each page.
BTITLE printspec [text|variable]
BTITLE [OFF|ON]
CHANGE Change text on the current line.
C /oldval/newval
CLEAR Clear the SQL*Plus screen and the screen buffer.
CLEAR {BREAKS|BUFFER|COLUMNS|COMPUTES|SCREEN|SQL TIMING}
COLUMN Change display width of a column.
COMPUTE Calculate and display totals.
CONNECT Connect to a database as a specified user.
connect username/password@SID
COPY Copy data from a query into a table (local or remote)
DEFINE User variables:
DEFINE varName = String
Display a user variable
DEFINE varName
Display all variables
DEFINE
DEL Delete the current line in the SQL buffer
DESC[RIBE] Describe a table, column, view, synonym, function
procedure, package or package contents.
DISCONNECT Logoff (but don't exit)
EDIT Load the SQL*Plus buffer into an editor.
By default, saves the file to AFIEDT.BUF
EXECUTE Run a single PLSQL statement
EXEC :answer := EMP_PAY.BONUS('SMITH')
EXIT [n] Commit, logoff and exit (n = error code)
EXIT SQL.SQLCODE
GET file Retrieve a previously stored command file
HELP topic Topic is an SQL PLUS command or HELP COMMANDS
HOST Execute a host operating system command
HOST CD scripts
INPUT Edit sql buffer - add line(s) to the buffer
LIST n m Edit sql buffer - display buffer lines n to m
For all lines - specify m as LAST
PAUSE message Wait for the user to hit RETURN
PRINT variable List the value of a bind variable or REF Cursor (see VARIABLE / SHOW)
PROMPT message Echo a message to the screen
REMARK REMARK comment or --comment-- or /* comment */
RUN Execute (or re-execute) commands in the SQL*Plus buffer
Lists the commands before running
RUNFORM Run a SQL*Forms application
SAVE file Save the contents of the SQL*Plus buffer in a command file
SAVE file [CRE[ATE] | REP[LACE] | APP[END]]
SET Display or change SQL*Plus settings
SHOW List the value of a system variable (see PRINT)
SHUTDOWN [ABORT|IMMEDIATE|NORMAL|TRANSACTIONAL]
SPOOL file Store query results in file
SPOOL OFF Turn off spooling
SPOOL OUT sends file to printer
SQLPLUS Start SQL*Plus and connect to a database.
STA[RT] Run an SQL Script (see @)
STARTUP [NoMOUNT|MOUNT|OPEN]
TIMING Record timing data TIMING {START | SHOW | STOP}
see CLEAR TIMING
TTITLE Define a page title
UNDEFINE Delete a user/substitution variable UNDEFINE varName (see DEFINE)
VARIABLE Define a bind variable (Can be used in both SQLPlus and PL/SQL)
VAR[IABLE] [variable {NUMBER|CHAR|CHAR(n)|REFCURSOR}]
A RefCursor bind variable can be used to reference PL/SQL cursor variables in stored procedures.
PRINT myRefCursor
EXECUTE somePackage.someProcedure(:myRefCursor)
VARIABLE on its own will display the definitions made.
WHENEVER OSERROR Exit if an OS error occurs
WHENEVER SQLERROR Exit if an SQL or PLSQL error occurs
SQL*Plus Prompt:
To display the currently connected UserName and SID, instead of just SQL>
SET sqlprompt '&_user:&_connect_identifier > '
Add the line above to the file: $ORACLE_SID/sqlplus/admin/glogin.sql (this tip requires Oracle 10g or greater)
“Client Servers were a tremendous mistake and we are sorry that we sold it to you. Instead of applications running on the desktop and data sitting on the server, everything will be Internet based” - Larry Ellison, CEO,
Oracle Corp.
source:http://ss64.com/ora/syntax-sqlplus.html
分享到:
相关推荐
Whether you’re relatively new to writing SQL or you’ve been writing it for years, learning to write “good” SQL is a process that requires a strong foundation knowledge of core syntax and ...SQL*Plus.
简要介绍了一些SQL的语句,最基础的对数据库的操作
用 iSQL*Plus 生成易读的输出 目标 替换变量 替换变量 使用 & 替换变量 使用 & 替换变量 替换变量的字符和数字值 指定列名、表达式和文本 指定列名、表达式和文本 定义替换变量 DEFINE 和 UNDEFINE 命令 使用带 & ...
wiley.ubuntu.linux.toolbox.1000.plus.commands.for.ubuntu.and.debian.power.users.nov.2007.pdf
Android 数据存储中,数据库存储中用到的就是轻量级的 SQL 语言,我们可以通过指令代码将数据保存到设备本地文件中。了解 SQL 的基本指令操作也是学习的 Android 基础。
基于C++ builder编制,具有SQL命令操作的功能
The book concludes with a comprehensive set of reference appendixes for command syntax, system stored procedures, information schema views, file system commands, and system management commands. ...
Linux Commands
Chapter 2—Beginning SQL Commands in Microsoft® SQL Server® 29 Chapter 3—Creating,Populating,Altering,and Deleting Tables 71 Chapter 4—Joins 101 Chapter 5—Functions 127 Chapter 6—Query ...
Wiley.SUSE.Linux.Toolbox.1000.plus.Commands.for.openSUSE.and.SUSE.Linux.Enterprise.Dec.2007.pdf
SQL.in.a.Nutshell.3rd.Edition SQL in a Nutshell, Third Edition, describes the latest ANSI standard, SQL2003 (SQL3) version of each SQL command, and then documents each platform’s ...syntax and commands.
Laravel开发-commands 这是为帮助开发工作中的每个人而创建的Laravel Artisan命令集合。
ZPL II Commands for RFID
FreeBSD Commands It is useful!
Unix shell commands,Unix shell commands
Oracle DBA commands
RDBMS concepts, and thorough coverage of basic SQL syntax and commands. Most importantly, programmers and developers who use SQL in a Nutshell will find a concise guide both to the most popular ...
Trusted Platform Module Library Part 3: Commands This TPM 2.0 Part 3 of the Trusted Platform Module Library specification contains the definitions of the TPM commands. These commands make use of the ...
db2 commands to use when operate db2 database.zip