Reserved keywords in Oracle



Last updated on July 17th, 2015 at 06:05 pm

There are certain keywords in oracle which can be used restrictively only. These values are defined in v$reserved_words table

SQL> desc v$reserved_words;
Name Null? Type
—————————————– ——– —————————-
KEYWORD VARCHAR2(30)
LENGTH NUMBER
RESERVED VARCHAR2(1)
RES_TYPE VARCHAR2(1)
RES_ATTR VARCHAR2(1)
RES_SEMI VARCHAR2(1)
DUPLICATE VARCHAR2(1)
-A value of column reserved Y means that the keyword cannot be used as an identifier. A value of N means that it is not reserved and hence can be used as an identifier.
-A value of column RES_TYPE Y means that the keyword cannot be used as a type name. A value of N means that it can be used as a type name.
-A value of column RES_ATTR Y means that the keyword cannot be used as an attribute name. A value of N means that it is not reserved as an attribute name.
-A value of column RES_SEMI 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.

In order words Y means the keyword is always reserved or N means it is reserved only for particular uses.

In order to know a complete list of oracle always reserved keywords you can query,

select keyword from v$reserved_words where reserved=’Y’;

SQL> select keyword from v$reserved_words where reserved=’Y’ order by keyword;

KEYWORD
——————————
!
&
(
)
*
+
,

.
/
:
< = >
@
ALL
ALTER
AND
ANY
AS
ASC
BETWEEN
BY
CHAR
CHECK
CLUSTER
COMPRESS
CONNECT
CREATE
DATE
DECIMAL
DEFAULT
DELETE
DESC
DISTINCT
DROP
ELSE
EXCLUSIVE
EXISTS
FLOAT
FOR
FROM
GRANT
GROUP
HAVING
IDENTIFIED
IN
INDEX
INSERT




Leave a Reply