Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: 'DESC' as column name
Hi Mark,
DESC is a reserved word (see Oracle 8i Oracle8i SQL Reference).
If you use it as a column name, it's your own problem, but here's a workaround :
Put the "DESC" column name into double quotes like this :
create table a ("DESC" number);
'select "DESC" from a ' will work, whereas
'select DESC from a' will *NOT* work.
Now you know the trick, but your co-workers may not know it and get stuck like you when they need that column. So change that column name ASAP and *never* use reserved words in column names again :-)
Regards,
Kenneth Koenraadt
Systems Consultant
plovmand@<no-spam>hotmail.com
On Thu, 24 May 2001 11:00:37 +0100, "Mark Wallace" <*CaN NoT HAvE SpaM*@no.spam.man> wrote:
>Is 'DESC' (as in a abbr for description) a reserved word for a column name?
>
>I successfully create a table with a column called DESC, but as soon as I
>try to add data to the column if get the following error :
>
> 1 INSERT INTO SRC.EVENT_CODES (ID, DESC)
> 2 VALUES
> 3* ('BB', 'BATCH')
>SQL> /
>INSERT INTO SRC.EVENT_CODES (ID, DESC)
> *
>ERROR at line 1:
>ORA-01747: invalid user.table.column, table.column, or column specification
>
>The table definitly exist and has a column called DESC as shown below :
>SQL> desc EVENT_CODES;
> Name Null? Type
> ----------------------------------------- -------- ------------
>
> ID NOT NULL VARCHAR2(10)
> NEWD VARCHAR2(30)
> DESC VARCHAR2(10)
>
>Thanks
>Mark
>
>
Received on Thu May 24 2001 - 05:13:25 CDT