7 Replies Latest reply: Mar 29, 2004 3:05 AM by APC RSS

    Reserved Words - 10g vs 9i

    Donbot
      The 10g PL/SQL and SQL reference docs list the same reserved words as for 9i. Is this correct? (Why wouldn't, for example, something like "REGEXP_LIKE" be reserved in 10g?)
        • 1. Re: Reserved Words - 10g vs 9i
          47519
          I've never really got to grips with how Oracle allows some words that you would think should be reserved as object names. Consider this...
          SQL> CREATE TABLE DECODE (TYPE VARCHAR2(10), OBJECT VARCHAR2(20))
            2  /

          Table created.

          SQL>
          Regards,
          Steve Rooney
          • 2. Re: Reserved Words - 10g vs 9i
            275989
            Hello. I'm one of the tech writers responsible for the Oracle SQL Reference.

            The reserved word list has been frozen for eons, so as not to break existing customer code. If we keep adding reserved words, it's very likely that we will pick something already used by a customer. It's not hard to imagine, for example, a customer writing his/her own function called DECODE or REGEXP_LIKE.

            The SQL Ref. has a section "How Oracle Database Resolves Schema Object References" (in Chapter 2) that describes how the database deals with ambiguous database object names. Hope this helps.

            Regards,
            Diana Lorentz
            • 3. Re: Reserved Words - 10g vs 9i
              KevinDClarke
              If you want to check which words are reserved, V$_RESERVED_WORD in the database might be more reliable than the documentation. There are also some words in the list which can be used, but we must assume that if we do so we might have problems in a future version.
              • 4. Re: Reserved Words - 10g vs 9i
                275989
                A small correction, Kevin. The words listed in V$RESERVED_WORDS are, for reasons unknown to me, not all reserved words. They are keywords. The list of truly reserved words in the SQL Reference is correct. I'll look into the V$RESERVED_WORDS issue and report back if I can find out why it is populated with keywords that are not reserved.

                Diana
                • 5. Re: Reserved Words - 10g vs 9i
                  3030
                  Don,

                  As Diana pointed out, the list of SQL reserved words has been frozen for a while. However, for PL/SQL, the current list of reserved keywords can be found by querying the v$reserved_words view. More than 200 new PL/SQL keywords (e.g., regexp_like) have been added to this view in 10g.

                  Regards,
                  Geoff
                  • 6. Re: Reserved Words - 10g vs 9i
                    159182
                    v$reserved_words only gives the keyword and length. Try x$kwddef, which gives the keyword, length, and type. A type of (x mod 4)=1 means a keyword, and a type of (x mod 4)=2 means a reserved word.
                    • 7. Re: Reserved Words - 10g vs 9i
                      APC
                      I'd just like to say 'Hi!' to Diane and Geoff. It's not often we get visitors from Oracle round these parts. It's nice to get some inside dope for once. Thanks for dropping by.

                      Cheers, APC