Yash Deshpande
Yash Deshpande

Reputation: 11

Table Creation Results into ORA-00904: : invalid identifier

I'm trying to create a table, but I keep getting this error:

ORA-00904: : invalid identifier

Please help.

CREATE TABLE salesreport 
(
    pid number(10) NOT NULL,
    uid number(10) NOT NULL,
    pname varchar2(50) NOT NULL,
    price number(10) NOT NULL,
    qty number(10) NOT NULL,
    dateoforder varchar2(20) DEFAULT NULL,
    total varchar2(30) NOT NULL
)

CREATE INDEX pid ON salesreport (pid, uid); 

Upvotes: 1

Views: 579

Answers (1)

Jucan
Jucan

Reputation: 421

uid is a reserved word. Pick something else and it should work.

OR write it like this

CREATE TABLE salesreport (
   pid number(10) NOT NULL,
  "uid" number(10) NOT NULL,
  pname varchar2(50) NOT NULL,
  price number(10) NOT NULL,
  qty number(10) NOT NULL,
  dateoforder date DEFAULT SYSDATE,
  total varchar2(30) NOT NULL
);

INDEX pid ON salesreport (pid,"uid");

Upvotes: 3

Related Questions