Reputation: 139
I am creating a table and I typed this command:
SQL> create table accident(report_number integer primary key,
2 date varchar(20),
3 location varchar(20));
I got this error:
date varchar(20),
*
ERROR at line 2:
ORA-00904: : invalid identifier
Can anyone tell me where the error is and how to rectify it?
Upvotes: 1
Views: 223
Reputation: 1709
Date
is a reserved word, to use it for column names, surround it with quotas "column-name"
ex:
create table abcd(
"date" date
);
insert into abcd values (sysdate);
select "date" from abcd;
But note that when using quoats, the column names will be case sensitive
ex:
select "Date" from abcd
will result in an "Date": invalid identifier
Upvotes: 0