Oracle® Database SQL Language Reference 11g Release 2 (11.2) E41084-02 |
|
| PDF · Mobi · ePub |
Graphic Syntax Diagrams
Syntax diagrams are drawings that illustrate valid SQL syntax. To read a diagram, trace it from left to right, in the direction shown by the arrows.
Commands and other keywords appear in UPPERCASE inside rectangles. Type them exactly as shown in the rectangles. Parameters(从句以及参数) appear in lowercase inside ovals. Variables are used for the parameters. Punctuation, operators, delimiters, and terminators appear inside circles.
If the syntax diagram has more than one path, then you can choose any path. For example, in the following syntax you can specify either NOPARALLEL
or PARALLEL
:
![Description of parallel_clause.gif follows](https://i-blog.csdnimg.cn/blog_migrate/4f7126d305df9857632c63c3e4dc7e53.gif)
Description of the illustration parallel_clause.gif
If you have the choice of more than one keyword, operator, or parameter, then your options appear in a vertical list. For example, in the following syntax diagram, you can specify one or more of the four parameters in the stack:
![Description of physical_attributes_clause.gif follows](https://i-blog.csdnimg.cn/blog_migrate/0aa65875e47fab660a5c93551b008c29.gif)
Description of the illustration physical_attributes_clause.gif
The following table shows parameters that appear in the syntax diagrams and provides examples of the values you might substitute for them in your statements:
Parameter | Description | Examples |
---|---|---|
| The substitution value must be the name of an object of the type specified by the parameter. For a list of all types of objects, see the section, "Schema Objects". |
|
| The substitution value must be a single character from your database character set. |
|
| The substitution value must be a text string in single quotation marks. See the syntax description of ' |
|
| The substitution value must be an expression of data type |
|
| The substitution value must be a condition that evaluates to |
|
| The substitution value must be a date constant or an expression of |
|
| The substitution value can be an expression of any data type as defined in the syntax description of expr in "About SQL Expressions". |
|
| The substitution value must be an integer as defined by the syntax description of integer in "Integer Literals". |
|
| The substitution value must be an expression of |
|
| The substitution value must be an expression of data type |
|
| The substitution value must be a |
|
| The substitution value must be the name of a nondefault database in an embedded SQL program. |
|
| The substitution value must be the database identification string for an Oracle Net database connection. For details, see the user's guide for your specific Oracle Net protocol. | — |
Required Keywords and Parameters
Required keywords and parameters can appear singly or in a vertical list of alternatives. Single required keywords and parameters appear on the main path, which is the horizontal line you are currently traveling. In the following example, library_name
is a required parameter:
![Description of drop_library.gif follows](https://i-blog.csdnimg.cn/blog_migrate/26826fe7cdc8eb621bd514894cc1a203.gif)
Description of the illustration drop_library.gif
If there is a library named HQ_LIB
, then, according to the diagram, the following statement is valid:
DROP LIBRARY hq_lib;
If multiple keywords or parameters appear in a vertical list that intersects the main path, then one of them is required. You must choose one of the keywords or parameters, but not necessarily the one that appears on the main path. In the following example, you must choose one of the two settings:
![Description of key_compression.gif follows](https://i-blog.csdnimg.cn/blog_migrate/561850f14af27f562f203db4374bb3c4.gif)
Description of the illustration key_compression.gif
Optional Keywords and Parameters
If keywords and parameters appear in a vertical list above the main path, then they are optional. In the following example, instead of traveling down a vertical line, you can continue along the main path:
![Description of deallocate_unused_clause.gif follows](https://i-blog.csdnimg.cn/blog_migrate/23c43e20b1715cee78ce7e07466adde2.gif)
Description of the illustration deallocate_unused_clause.gif
![Description of size_clause.gif follows](https://i-blog.csdnimg.cn/blog_migrate/b024ac1ec9210011c30505428f171ebd.gif)
Description of the illustration size_clause.gif
According to the diagrams, all of the following statements are valid:
DEALLOCATE UNUSED; DEALLOCATE UNUSED KEEP 1000; DEALLOCATE UNUSED KEEP 10G; DEALLOCATE UNUSED 8T; 注释:DEALLOCATE UNUSED KEEP 10G;该语句中10就是integer(即整数类型的数据),G就是图中那好几大写字母中的G。
同时,我们发现,在旁支上的有些关键字是可以省略的,如keep。例如, DEALLOCATE UNUSED 8T;
再例如,
在alter database语句中,
alter_datafile_clause::=
datafile filenumber offline for drop中的for可以省略。
Syntax Loops
Loops let you repeat the syntax within them as many times as you like. In the following example, after choosing one value expression, you can go back repeatedly to choose another, separated by commas.
![Description of query_partition_clause.gif follows](https://i-blog.csdnimg.cn/blog_migrate/6a30b9603a29ad966a5400d0b4976def.gif)
Description of the illustration query_partition_clause.gif
Multipart Diagrams
Read a multipart diagram as if all the main paths were joined end to end. The following example is a three-part diagram:
![Description of alter_java.gif follows](https://i-blog.csdnimg.cn/blog_migrate/49798a18e4e48fe3cae0b58ebae39083.gif)
Description of the illustration alter_java.gif
According to the diagram, the following statement is valid:
ALTER JAVA SOURCE jsource_1 COMPILE;
Database Objects
The names of Oracle identifiers, such as tables and columns, must not exceed 30 characters in length. The first character must be a letter, but the rest can be any combination of letters, numerals, dollar signs ($), pound signs (#), and underscores (_).
However, if an Oracle identifier is enclosed by double quotation marks ("), then it can contain any combination of legal characters, including spaces but excluding quotation marks. Oracle identifiers are not case sensitive except within double quotation marks.
See Also:
"Database Object Naming Rules" for more information