Thursday, November 27, 2008

V$RESERVED_WORDS

V$RESERVED_WORDS displays 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.

Column

Datatype

Description

KEYWORD

VARCHAR2(30)

Name of the keyword

LENGTH

NUMBER

Length of the keyword

RESERVED

VARCHAR2(1)

Indicates whether the keyword cannot be used as an identifier (Y) or whether the keyword is not reserved (N)

RES_TYPE

VARCHAR2(1)

Indicates whether the keyword cannot be used as a type name (Y) or whether the keyword is not reserved (N)

RES_ATTR

VARCHAR2(1)

Indicates whether the keyword cannot be used as an attribute name (Y) or whether the keyword is not reserved (N)

RES_SEMI

VARCHAR2(1)

Indicates whether the keyword is not allowed as an identifier in certain situations, such as in DML (Y) or whether the keyword is not reserved (N)

DUPLICATE

VARCHAR2(1)

Indicates whether the keyword is a duplicate of another keyword (Y) or whether the keyword is not a duplicate (N)

Note:

1. Keywords contained in the view are expanding:

select count(*) from V$RESERVED_WORDS;

8.1.7.4.0

9.2.0.8.0

10.2.0.2.0

10.2.0.3.0

11.1.0.6.0

660

811

1133

1142

1733

2. Get the definition of V$RESERVED_WORDS:

SELECT view_definition

FROM v$fixed_view_definition

WHERE view_name = 'V$RESERVED_WORDS';

Result:

select inst_id, keyword, length,

decode(mod(trunc(type/2),2),0,'N',1,'Y','?') reserved,

decode(mod(trunc(type/4),2),0,'N',1,'Y','?') res_type,

decode(mod(trunc(type/8),2),0,'N',1,'Y','?') res_attr,

decode(mod(trunc(type/16),2),0,'N',1,'Y','?') res_semi,

decode(mod(trunc(type/32),2),0,'N',1,'Y','?') duplicate

from x$kwddef;

3. Query the reserved words in Oracle 11.1.0.6.0

select *

from V$RESERVED_WORDS

where reserved = 'Y'

order by keyword;


KEYWORD

LENGTH

RESERVED

RES_TYPE

RES_ATTR

RES_SEMI

DUPLICATE

!

1

Y

N

N

N

N

&

1

Y

N

N

N

N

(

1

Y

N

N

N

N

)

1

Y

N

N

N

N

*

1

Y

N

N

N

N

+

1

Y

N

N

N

N

,

1

Y

N

N

N

N

-

1

Y

N

N

N

N

.

1

Y

N

N

N

N

/

1

Y

N

N

N

N

:

1

Y

N

N

N

N

<

1

Y

N

N

N

N

=

1

Y

N

N

N

N

>

1

Y

N

N

N

N

@

1

Y

N

N

N

N

ALL

3

Y

N

N

N

N

ALTER

5

Y

N

N

N

N

AND

3

Y

N

N

N

N

ANY

3

Y

N

N

N

N

AS

2

Y

N

N

N

N

ASC

3

Y

N

N

N

N

BETWEEN

7

Y

N

N

N

N

BY

2

Y

N

N

N

N

CHAR

4

Y

N

N

N

Y

CHECK

5

Y

N

N

N

N

CLUSTER

7

Y

N

N

N

N

COMPRESS

8

Y

N

N

N

N

CONNECT

7

Y

N

N

N

N

CREATE

6

Y

N

N

N

N

DATE

4

Y

N

N

N

N

DECIMAL

7

Y

N

N

N

Y

DEFAULT

7

Y

N

N

N

N

DELETE

6

Y

N

N

N

N

DESC

4

Y

N

N

N

N

DISTINCT

8

Y

N

N

N

N

DROP

4

Y

N

N

N

N

ELSE

4

Y

N

N

N

N

EXCLUSIVE

9

Y

N

N

N

N

EXISTS

6

Y

N

N

N

N

FLOAT

5

Y

N

N

N

N

FOR

3

Y

N

N

N

N

FROM

4

Y

N

N

N

N

GRANT

5

Y

N

N

N

N

GROUP

5

Y

N

N

N

N

HAVING

6

Y

N

N

N

N

IDENTIFIED

10

Y

N

N

N

N

IN

2

Y

N

N

N

N

INDEX

5

Y

N

N

N

N

INSERT

6

Y

N

N

N

N

INTEGER

7

Y

N

N

N

Y

INTERSECT

9

Y

N

N

N

N

INTO

4

Y

N

N

N

N

IS

2

Y

N

N

N

N

LIKE

4

Y

N

N

N

N

LOCK

4

Y

N

N

N

N

LONG

4

Y

N

N

N

N

MINUS

5

Y

N

N

N

N

MODE

4

Y

N

N

N

N

NOCOMPRESS

10

Y

N

N

N

N

NOT

3

Y

N

N

N

N

NOWAIT

6

Y

N

N

N

N

NULL

4

Y

N

N

N

N

NUMBER

6

Y

N

N

N

N

OF

2

Y

N

N

N

N

ON

2

Y

N

N

N

N

OPTION

6

Y

N

N

N

N

OR

2

Y

N

N

N

N

ORDER

5

Y

N

N

N

N

PCTFREE

7

Y

N

N

N

N

PRIOR

5

Y

N

N

N

N

PUBLIC

6

Y

N

N

N

N

RAW

3

Y

N

N

N

N

RENAME

6

Y

N

N

N

N

RESOURCE

8

Y

N

N

N

N

REVOKE

6

Y

N

N

N

N

SELECT

6

Y

N

N

N

N

SET

3

Y

N

N

N

N

SHARE

5

Y

N

N

N

N

SIZE

4

Y

N

N

N

N

SMALLINT

8

Y

N

N

N

Y

START

5

Y

N

N

N

N

SYNONYM

7

Y

N

N

N

N

TABLE

5

Y

N

N

N

N

THEN

4

Y

N

N

N

N

TO

2

Y

N

N

N

N

TRIGGER

7

Y

N

N

N

N

UNION

5

Y

N

N

N

N

UNIQUE

6

Y

N

N

N

N

UPDATE

6

Y

N

N

N

N

VALUES

6

Y

N

N

N

N

VARCHAR

7

Y

N

N

N

N

VARCHAR2

8

Y

N

N

N

N

VIEW

4

Y

N

N

N

N

WHERE

5

Y

N

N

N

N

WITH

4

Y

N

N

N

N

[

1

Y

N

N

N

N

]

1

Y

N

N

N

N

^

1

Y

N

N

N

N

|

1

Y

N

N

N

N

0

Y

N

N

N

N


Oracle data dictionary views

Oracle dynamic performance views