Friday, August 31, 2018

Reserved KeyWords in Oracle

Oraclehas several reserved words and these keywords can't be used in different places like naming in identifier or in attribute.

The v$reserved_words view show a list of reserved keywords in oracle.


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)

The RESERVED field value Y indicates that the corresponding row is always reserved and hence we can't name in anywhere in oracle as it's name.

If the RESERVED field value is N then it indicates that the keyword is not always reserved and hence can be used based on RES_TYPE, RES_ATTR, RES_SEMI value.

There are four kinds of Reserved objects:


  • Oracle Reserved Words
  • Oracle Keywords
  • PL/SQL Reserved Words
  • Oracle Reserved Namespaces


Oracle Reserved Words have a special meaning to Oracle and they cannot be redefined to name database objects such as columns, tables, or indexes.

Oracle Keywords also have a special meaning to Oracle but are not reserved words and so can be redefined. However, some might eventually become reserved words.

PL/SQL Reserved Words are those that may require special treatment when used in embedded SQL statements

Oracle Reserved Namespaces are reserved by Oracle. The function names in Oracle libraries have initial characters which are restricted to the following strings. To avoid potential name conflicts, do not use function names that begin with these characters.

Namespace - Library 
O        -         OCI functions
S        -          function names from SQLLIB and system-dependent libraries
XA     -         external functions for XA applications only
GEN KP L NA NC ND NL NM NR NS NT NZ TTC - UPI Internal functions

No comments:

Post a Comment

Query To Fetch AP Invoice Details From SO Number(Doc ID 2949013.1)

SELECT dh.source_order_number       ,df.source_line_number as so_line_number   ,df.fulfill_line_number    ,ddr.doc_user_key as po_number...