Can I use 'ORDER' as the table name to create a table?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Can I use 'ORDER' as the table name to create a table?

  1. #1
    Join Date
    Oct 2003
    Posts
    27

    Can I use 'ORDER' as the table name to create a table?

    Is ORDER a reserved word in Oracle?

    I created a table called ORDER without any problem, and I tried to drop it and I couldn't.

    SQL> desc order;
    ERROR:
    ORA-00931: missing identifier

    SQL> drop table order;
    drop table order
    *
    ERROR at line 1:
    ORA-00903: invalid table name

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095

    Re: Can I use 'ORDER' as the table name to create a table?

    Originally posted by jack999
    Is ORDER a reserved word in Oracle?
    Of course it is...
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    May 2001
    Location
    Maryland, USA
    Posts
    409
    Code:
    sql> create table ORDER (c1 number);
    create table ORDER (c1 number)
                 *
    ERROR at line 1:
    ORA-00903: invalid table name
    
    
    Elapsed: 00:00:00.16
    sql> create table "order" (c1 number);
    
    Table created.
    
    Elapsed: 00:00:00.32
    sql> desc order
    ERROR:
    ORA-00931: missing identifier
    
    
    sql> desc "order"
     Name                                                                 Null?    Type
     -------------------------------------------------------------------- -------- ---------------------
     C1                                                                            NUMBER
    
    sql> drop table order;
    drop table order
               *
    ERROR at line 1:
    ORA-00903: invalid table name
    
    
    Elapsed: 00:00:00.00
    
    sql> drop table "order";
    
    Table dropped.
    
    Elapsed: 00:00:00.31
    Maybe you created table "ORDER" using quotes.

    HTH
    Last edited by patel_dil; 11-18-2003 at 01:40 PM.
    -- Dilip

  4. #4
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Five finger exercise on a theme proposed by slimdave. Second variation (after edit!):
    Code:
    SQL> create table "from" 
    ("select" varchar2(10),
     "where" varchar2(10),
     "order by" varchar2(10));
    
    Table created.
    
    SQL> insert into "from" values ('select','where','order by');
    
    1 row created.
    
    SQL> select "select"
      2  from   "from"
      3  where  "where" = 'where'
      4  order by "order by"
      5  /
    
    select
    ----------
    select
    Last edited by DaPi; 11-18-2003 at 06:04 PM.

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    http://download-west.oracle.com/docs...ts9a.htm#27571

    Schema Object Naming Rules
    Every database object has a name. In a SQL statement, you represent the name of an object with a quoted identifier or a nonquoted identifier.

    A quoted identifier begins and ends with double quotation marks ("). If you name a schema object using a quoted identifier, then you must use the double quotation marks whenever you refer to that object.
    A nonquoted identifier is not surrounded by any punctuation.
    You can use either quoted or nonquoted identifiers to name any database object, with one exception: database links must be named with nonquoted identifiers. In addition, Oracle Corporation strongly recommends that you not use quotation marks to make usernames and passwords case sensitive.

    See Also:
    CREATE USER for additional rules for naming users and passwords


    The following list of rules applies to both quoted and nonquoted identifiers unless otherwise indicated:

    Names must be from 1 to 30 bytes long with these exceptions:
    Names of databases are limited to 8 bytes.
    Names of database links can be as long as 128 bytes.
    Nonquoted identifiers cannot be Oracle reserved words. Quoted identifiers can be reserved words, although this is not recommended.

    Depending on the Oracle product you plan to use to access a database object, names might be further restricted by other product-specific reserved words.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width