( SS64 ) Oracle Syntax SQL*Plus commands The following commands can be issued in SQL*Plus (in addition to the

standard SQ L commands.) 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 di rectory of SQL*Plus. @C:\work\oracle\ScriptName.sql will call a sub-script from a spec ific directory. @@pathname Run (START) an SQL Script @@ will call a sub-script from the same directory as the main scr ipt. @variable A substitution variable @pathname

@@variable A substitution variable valid for the session / ACCEPT Execute (or re-execute) commands in the SQL*Plus buffer does not list commands before running User input ACC[EPT] variable [NUM[BER]|CHAR|DATE] [FORMAT format] [DEFAULT default] [PROMPT text|NOPROMPT] [HIDE] Add text to the end of the current line in the buffer. A[PPEND] text_to_add Specify where and how formatting will change. BREAK ON {column|expr|ROW|REPORT} action Place and format a title at the bottom of each page. BTITLE printspec [text|variable] BTITLE [OFF|ON] Change text on the current line. C /oldval/newval Clear the SQL*Plus screen and the screen buffer. CLEAR {BREAKS|BUFFER|COLUMNS|COMPUTES|SCREEN|SQL TIMING} Change display width of a column. Calculate and display totals. Connect to a database as a specified user. connect username/password@SID Copy data from a query into a table (local or remote) User variables: DEFINE varName = String



function procedure.display buffer lines n to m For all lines . logoff and exit (n = error code) EXIT SQL.SQLCODE Retrieve a previously stored command file HELP topic Topic is an SQL PLUS command or HELP COMMANDS HOST INPUT LIST n m Execute a host operating system command HOST CD scripts Edit sql buffer .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.add line(s) to the buffer Edit sql buffer . By default. DISCONNECT Logoff (but don't exit) EDIT EXECUTE EXIT [n] GET file Load the SQL*Plus buffer into an editor. synonym.BUF Run a single PLSQL statement EXEC :answer := EMP_PAY. view.BONUS('SMITH') Commit. saves the file to AFIEDT. package or package contents.specify m as LAST Wait for the user to hit RETURN PAUSE message PRINT variable List the value of a bind variable or REF Cursor (see VARIABLE / SHOW) PROMPT message Echo a message to the screen REMARK RUN RUNFORM SAVE file SET SHOW REMARK comment or --comment-.or /* comment */ Execute (or re-execute) commands in the SQL*Plus buffer Lists the commands before running Run a SQL*Forms application Save the contents of the SQL*Plus buffer in a command file SAVE file [CRE[ATE] | REP[LACE] | APP[END]] Display or change SQL*Plus settings List the value of a system variable (see PRINT) SHUTDOWN [ABORT|IMMEDIATE|NORMAL|TRANSACTIONAL] SPOOL file Store query results in file .

Related: Editing SQL scripts in SQL*Plus SQL-Plus.sql (this tip r equires Oracle 10g or greater) Client Servers were a tremendous mistake and we are sorry that we sold it to you. instead of just SQL> SET sqlprompt '&_user:&_connect_identifier > ' Add the line above to the file: $ORACLE_SID/sqlplus/admin/glogin.SPOOL OFF SQLPLUS STA[RT] Turn off spooling SPOOL OUT sends file to printer Start SQL*Plus and connect to a database. Instead of applications running on the desktop and data sitting on the server. PRINT myRefCursor EXECUTE somePackage. Run an SQL Script (see @) STARTUP [NoMOUNT|MOUNT|OPEN] TIMING TTITLE UNDEFINE ) VARIABLE Define a bind variable (Can be used in both SQLPlus and PL/SQL) VAR[IABLE] [variable {NUMBER|CHAR|CHAR(n)|REFCURSOR}] Record timing data TIMING {START | SHOW | STOP} see CLEAR TIMING Define a page title Delete a user/substitution variable UNDEFINE varName (see DEFINE A RefCursor bind variable can be used to reference PL/SQL cursor variables in stored procedures.Larry Ellison. CEO. Oracle Corp.com . 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.SQL*Plus Tutorial Back to the Top © Copyright SS64. everything will be Internet based .com 1999-2013 Some rights reserved .someProcedure(:myRefCursor) VARIABLE on its own will display the definitions made.

Sign up to vote on this title
UsefulNot useful