1

I was working in sql command line and got this error ORA-00904 when i queried to create a table

Query Screenshot

I tried various inputs and got the same error in line 4. Help me out.

LukStorms
  • 28,916
  • 5
  • 31
  • 45
its-akhr
  • 122
  • 1
  • 1
  • 10

1 Answers1

1

If you create a table

Then this would work :

CREATE TABLE DATA
(
  ID INT NOT NULL,
  NAME VARCHAR2(10) NOT NULL
);

But this would raise an ORA-00904 :

CREATE TABLE DATA
(
  ID INT NOT NULL,
  NAME VARCHAR2(10) NOT NULL,
);

The difference?
After that last comma, something more is expected.
Yet, all it finds is a round bracket.
Hence, the error.

LukStorms
  • 28,916
  • 5
  • 31
  • 45
  • @HiteshRam Notice that I changed the VARCHAR to a VARCHAR2. You can read more about that [here](https://stackoverflow.com/questions/1171196/). – LukStorms Jul 29 '18 at 11:27
  • Please accept this answer if this solved your question/problem so it can be treated as a closed question. Give credit where credit is due. – brenners1302 Jul 30 '18 at 08:05
  • @HiteshRam Btw, you could give that ID an IDENTITY. So that you don't have to insert the ID numbers yourself. You can read more about that [here](https://stackoverflow.com/questions/11296361/). And quoting table names or field names isn't really mandatory. It's fine to leave them unquoted as long the name doesn't contain spaces, and it's not some restricted key word. – LukStorms Jul 30 '18 at 08:48