2

Whats wrong with this query : I am getting following error

SQL Error: ORA-00905: missing keyword 00905. 00000 - "missing keyword"

it says error at 4th row. Please advise

CREATE TABLE ORDERS
(
ID INT        NOT NULL,
ord_date    DATE, 
AMOUNT     double,
CUSTOMER_ID INT references CUSTOMERS(ID),
PRIMARY KEY (ID)
);
Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
coder1608
  • 171
  • 6
  • 14
  • 2
    shouldn't your `double` be a `number(10, 2)` or something similar depending on what you need? – Nico Feb 15 '15 at 03:14
  • 1
    @NicolásCarlo - I just tried double .but it seems it won't work in oracle 11g. As per your suggestion I tried number .. it worked executed fine. Thanks for info. – coder1608 Feb 15 '15 at 03:19
  • No problem but @NoDisplayName 's answer is probably what you're looking for. – Nico Feb 15 '15 at 03:20
  • Yes .. I appreciate your broad mind @NicolásCarlo. Have a nice day. – coder1608 Feb 15 '15 at 03:25

2 Answers2

7

You missed to add precision in double datatype

CREATE TABLE ORDERS
(
   ID INT        NOT NULL,
   ord_date    DATE, 
   AMOUNT     double precision,
   CUSTOMER_ID INT references CUSTOMERS(ID),
   PRIMARY KEY (ID)
);

SQLFIDDLE DEMO

For more info check here

Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
0

You can use BIGINT or DECIMAL type for double type.

bruntime
  • 371
  • 2
  • 13
p.Monadi
  • 1
  • 2
  • 6