首页 > 数据库 > mysql教程 > Oracle中的关键字 保留字

Oracle中的关键字 保留字

WBOY
发布: 2016-06-07 17:23:32
原创
1128 人浏览过

Oracle官方文档说明: Reserved words and keywordsare identifiers that have special meaning in PL/SQL. You cannot use rese

Oracle官方文档说明:

Reserved words and keywordsare identifiers that have special meaning in PL/SQL.

You cannot use reserved words as ordinary user-defined identifiers. You can use them as quoted user-defined identifiers, but it is not recommended. For more information, see"QuotedUser-Defined Identifiers".

You can use keywords as ordinary user-defined identifiers,but it is not recommended.

不能使用保留字作为用户定义的变量。但是当加上双引号就可以,但是不推存。

关键字就可以作为用户定义的变量,但是不推存。

举例子:

(1)保留字

-- number

创建表,作为字段名。

SQL> CREATE TABLE cux_oyj_RESERVED_WORDS(NUMBER NUMBER);

CREATE TABLE cux_oyj_RESERVED_WORDS(NUMBER NUMBER)

ORA-00904: : 标识符无效

加上双引号,就可以

SQL> CREATE TABLE cux_oyj_RESERVED_WORDS("NUMBER" NUMBER);

Table created

但是查询:

SQL> SELECT rw.number from cux_oyj_RESERVED_WORDS rw;

SELECT rw.number from cux_oyj_RESERVED_WORDS rw

ORA-01747: user.table.column, table.column 或列说明无效

使用起来比较麻烦。

(2)关键字

--name

创建表,,作为字段名。

SQL> CREATE TABLE cux_oyj_KEYWORDS(NAME VARCHAR2(50));

Table created

保留字与关键字的视图(动态视图)V$RESERVED_WORDS

This view gives a list of all SQL keywords. To determine whether a particular keyword is reserved in any way, check the RESERVED, RES_TYPE, RES_ATTR, and RES_SEMI columns.

ColumnDatatypeDescription

KEYWORD VARCHAR2(30) Name of the keyword

LENGTH NUMBER Length of the keyword

RESERVED VARCHAR2(1) A value of Y means that the keyword cannot be used as an identifier. A value of N means that it is not reserved.

RES_TYPE VARCHAR2(1) A value of Y means that the keyword cannot be used as a type name. A value of N means that it is not reserved.

RES_ATTR VARCHAR2(1) A value of Y means that the keyword cannot be used as an attribute name. A value of N means that it is not reserved.

RES_SEMI VARCHAR2(1) A value of Y means that the keyword is not allowed as an identifier in certain situations, such as in DML. A value of N means that it is not reserved.

DUPLICATE VARCHAR2(1) A value of Y means that the keyword is a duplicate of another keyword. A value of N means that it is not a duplicate.

保留字:

Begins with:Reserved Words

A

ALL, ALTER, AND, ANY, AS, ASC, AT

B

BEGIN, BETWEEN, BY

C

CASE, CHECK, CLUSTERS, CLUSTER, COLAUTH, COLUMNS, COMPRESS, CONNECT, CRASH, CREATE, CURSOR

D

DECLARE, DEFAULT, DESC, DISTINCT, DROP

E

ELSE, END, EXCEPTION, EXCLUSIVE

F

FETCH, FOR, FROM, FUNCTION

G

GOTO, GRANT, GROUP

H

HAVING

I

IDENTIFIED, IF, IN, INDEX, INDEXES, INSERT, INTERSECT, INTO, IS

L

LIKE, LOCK

M

MINUS, MODE

N

NOCOMPRESS, NOT, NOWAIT, NULL

O

OF, ON, OPTION, OR, ORDER, OVERLAPS

P

PROCEDURE, PUBLIC

R

RESOURCE, REVOKE

S

SELECT, SHARE, SIZE, SQL, START, SUBTYPE

T

TABAUTH, TABLE, THEN, TO, TYPE

U

UNION, UNIQUE, UPDATE

V

VALUES, VIEW, VIEWS

W

WHEN, WHERE, WITH

关键字:

Begins with:Keywords

A

A, ADD, AGENT, AGGREGATE, ARRAY, ATTRIBUTE, AUTHID, AVG

B

BFILE_BASE, BINARY, BLOB_BASE, BLOCK, BODY, BOTH, BOUND, BULK, BYTE

C

C, CALL, CALLING, CASCADE, CHAR, CHAR_BASE, CHARACTER, CHARSET, CHARSETFORM, CHARSETID, CLOB_BASE, CLOSE, COLLECT, COMMENT, COMMIT, COMMITTED, COMPILED, CONSTANT, CONSTRUCTOR, CONTEXT, CONTINUE, CONVERT, COUNT, CURRENT, CUSTOMDATUM

D

DANGLING, DATA, DATE, DATE_BASE, DAY, DEFINE, DELETE, DETERMINISTIC, DOUBLE, DURATION

E

ELEMENT, ELSIF, EMPTY, ESCAPE, EXCEPT, EXCEPTIONS, EXECUTE, EXISTS, EXIT, EXTERNAL

F

FINAL, FIXED, FLOAT, FORALL, FORCE

G

GENERAL

H

HASH, HEAP, HIDDEN, HOUR

I

IMMEDIATE, INCLUDING, INDICATOR, INDICES, INFINITE, INSTANTIABLE, INT, INTERFACE, INTERVAL, INVALIDATE, ISOLATION

J

JAVA

L

LANGUAGE, LARGE, LEADING, LENGTH, LEVEL, LIBRARY, LIKE2, LIKE4, LIKEC, LIMIT, LIMITED, LOCAL, LONG, LOOP

M

MAP, MAX, MAXLEN, MEMBER, MERGE, MIN, MINUTE, MOD, MODIFY, MONTH, MULTISET

N

NAME, NAN, NATIONAL, NATIVE, NCHAR, NEW, NOCOPY, NUMBER_BASE

O

OBJECT, OCICOLL, OCIDATE, OCIDATETIME, OCIDURATION, OCIINTERVAL, OCILOBLOCATOR, OCINUMBER, OCIRAW, OCIREF, OCIREFCURSOR, OCIROWID, OCISTRING, OCITYPE, OLD, ONLY, OPAQUE, OPEN, OPERATOR, ORACLE, ORADATA, ORGANIZATION, ORLANY, ORLVARY, OTHERS, OUT, OVERRIDING

P

PACKAGE, PARALLEL_ENABLE, PARAMETER, PARAMETERS, PARENT, PARTITION, PASCAL, PIPE, PIPELINED, PRAGMA, PRECISION, PRIOR, PRIVATE

R

RAISE, RANGE, RAW, READ, RECORD, REF, REFERENCE, RELIES_ON, REM, REMAINDER, RENAME, RESULT, RESULT_CACHE, RETURN, RETURNING, REVERSE, ROLLBACK, ROW

S

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板