(O'Reilly) Oracle SQL Plus (Pocket Reference, 2nd Edition).pdf

(827 KB) Pobierz
22908607 UNPDF
Oracle SQL*PlusPocket Reference
1.1 Introduction
The Oracle SQL*Plus Pocket Reference is a quick-reference guide to SQL*Plus and to commonly
used SQL query and data manipulation statements. The purpose of this book is to help you find the
syntax of specific language elements. It is not a self-contained user guide; basic knowledge of
SQL*Plus is assumed. For more information, see my book Oracle SQL*Plus: The Definitive Guide
(O'Reilly) and Mastering Oracle SQL by Sanjay Mishra and Alan Beaulieu (O'Reilly).
1.1.1 Acknowledgments
Deborah Russell, Darl Kuhn, Ken Jacobs, and Alison Holloway all played a part in making this book
a reality. For their assistance and support, I'm most grateful.
1.1.2 Conventions
UPPERCASE
Indicates SQL*Plus, SQL, or PL/SQL keywords
lowercase
Indicates user-defined items such as table names
Italic
Indicates filenames, emphasis, introduction of new terms, and parameter names
Constant width
Used for code examples
Constant width bold
Indicates user input in examples showing an interaction
[ ]
Used in syntax descriptions to denote optional elements
{ }
Used in syntax descriptions to denote a required choice
|
Used in syntax descriptions to separate choices
_
Used in syntax descriptions to indicate that the underlined option is the default
1.2 Interacting with SQL*Plus
This section covers essential information you need to know to interact with SQL*Plus. Here you will
learn how to start SQL*Plus, enter commands, delimit strings, and name variables.
1.2.1 Starting SQL*Plus
Invoke SQL*Plus by issuing the sqlplus command from your operating-system command prompt.
On Microsoft Windows systems, use either sqlplus or sqlplusw depending on whether you want
SQL*Plus to run in a command-prompt window or in its own window; you can also select an icon
from the Start menu. (Early releases of SQL*Plus on Windows used executable names such as
PLUS33 and PLUS80W .)
Beware of passing your password as a command-line argument to
SQL*Plus. Such passwords may be easily visible to other users on Linux
and Unix systems.
22908607.036.png 22908607.037.png 22908607.038.png 22908607.001.png 22908607.002.png 22908607.003.png 22908607.004.png 22908607.005.png 22908607.006.png 22908607.007.png 22908607.008.png 22908607.009.png 22908607.010.png 22908607.011.png 22908607.012.png 22908607.013.png 22908607.014.png 22908607.015.png 22908607.016.png 22908607.017.png 22908607.018.png 22908607.019.png 22908607.020.png 22908607.021.png 22908607.022.png 22908607.023.png 22908607.024.png 22908607.025.png 22908607.026.png 22908607.027.png 22908607.028.png 22908607.029.png 22908607.030.png 22908607.031.png 22908607.032.png 22908607.033.png 22908607.034.png
1.2.1.1 Syntax for the sqlplus command
The syntax used to invoke SQL*Plus is as follows:
sqlplus [[-S[ILENT]] [-H[ELP]] [-V[ERSION]]
[-R[ESTRICT] level] [-L[OGON]]
[-M[ARKUP] "markup_options"]
[ [username[/password][@connect]|/
[AS {SYSDBA|SYSOPER}]]
|/NOLOG]
[@scriptfile [arg1 arg2 arg3...]]]
The -RESTRICT and -MARKUP parameters are new in Oracle8 i . -HELP and -VERSION are new
in Oracle9 i . Here are the parameter descriptions:
-S[ILENT]
Tells SQL*Plus to run in silent mode. No startup message is displayed; no command
prompt is displayed; no commands are echoed to the screen.
-H[ELP]
Causes SQL*Plus to display a short summary of this syntax. Prior to Oracle9 i , use sqlplus -
to get the help summary.
-V[ERSION]
Causes SQL*Plus to display version and copyright information. Prior to Oracle9 i , use
sqlplus -? to get version and copyright information.
-R[ESTRICT] level
Restricts what the user can do from SQL*Plus. The level must be one of the following:
1
Disables the EDIT, HOST, and ! commands
2
Disables the EDIT, HOST, !, SAVE, SPOOL, and STORE commands
3
Disables the EDIT, GET, HOST, !, SAVE, START, @, @@, SPOOL, and STORE
commands
Level 3 also disables the reading of the login.sql file. The glogin.sql file is read, but
restricted commands aren't executed.
-L[OGON] (new in Oracle9 i Release 9.2)
Prevents SQL*Plus from reprompting for the username and password in the event that the
first username and password passed is incorrect.
-M[ARKUP] markup_options
Allows you to specify the markup language to use when generating output. Except for
HTML, all markup options are optional. The following are valid markup options. Default
values are underlined or noted in the text.
HTML {ON | OFF}
Specifies the markup language to use and enables or disables the use of that markup
language. You must specify a value for this option.
HEAD text
Specifies content for the <head> tag. The tag is written as <head> text </head>.
BODY text
Specifies attributes for the <body> tag. The tag is written as <body text >.
TABLE text
Specifies attributes for the <table> tag that formats query output. The tag is written as
<table text >.
ENTMAP {ON | OFF}
Controls whether SQL*Plus uses HTML equivalents such as &lt; and &gt; for special
characters such as "<" and ">".
SPOOL {ON | OFF}
Controls whether SQL*Plus writes <html>, <head>, and <body> tags to any spool file you
create during your SQL*Plus session, while HTML is ON.
PRE[FORMAT] {ON | OFF}
Controls whether query output is enclosed within <pre> ... </pre> tags rather than within
HTML tables.
On some operating systems, you need to enclose the entire string of markup options within
double quotes. For example:
sqlplus -m "html on spool off"
Furthermore, any HEAD, BODY, and TABLE text should itself be quoted, and you must
escape the quotes:
sqlplus -m "html on table \"width=50% align='left'\""
The backslash-quote ( \" ) syntax works on Windows XP, Linux, and Unix, and places a
quote ( " ) within the string that is the value for the -M option.
username [/ password ][@ connect ]
Your database login information. connect is an Oracle Net connect identifier such as those
defined in $ORACLE_HOME/network/admin/tnsnames.ora .
Zgłoś jeśli naruszono regulamin