Skip to content
Advertisement

Oracle table create error ORA-00904 invalid identifier

It’s very interesting I don’t know why I’m getting ORA-00904 invalid identifier when I’m trying to create a table with oracle.

Advertisement

Answer

When creating tables with CREATE TABLE in Oracle, you have at least four ways to specify constraints.

In-line specification

In-line specification with explicit constraints’ names

Out-line specification

Out-line specification with explicit constraints’ names

If you don’t explicitly specify constraints names, they are generated automatically by the system, and read something like SYS_C0013321. I find the last way the most readable, because you see which constraints are created, and can manage them using user-friendly names (e. g. using view user_constraints).

By the way, there’s a typo in your code: you should use PRIMARY KEY instead of PRIMARY_KEY.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement