Search code examples
sqloracle-databasecreate-table

Getting ORA-00904: : invalid identifier in oracle application express


I want to create this simple table in oracle application express but i keep getting the error

ORA-00904: : invalid identifier

and I have no idea why.

CREATE TABLE ArtWork (
    ArtWorkId NUMBER (6,0) CONSTRAINT aw_pk PRIMARY KEY,
    Name VARCHAR2 (20),
    Desc VARCHAR2 (25)
);

Solution

  • desc is a reserved word (it is used to to specifiy the sort direction, for example in an order by clause).

    You need to either surround it with double quotes, or better yet change your column name to something that does not clash with a language keyword, so you don't need to worry about it later on:

    CREATE TABLE ArtWork (
        ArtWorkId NUMBER (6,0) CONSTRAINT aw_pk PRIMARY KEY,
        Name VARCHAR2 (20),
        Description VARCHAR2 (25)
    );