Create Table Non_Game
(
P_Id int Not_Null,
Item_Num Char(4) Not Null,
Description Char(30),
On_Hand Decimal(4,0)
Category Char(3)
Price Decimal(6,2),
))

Dani AI

Generated

Good catch by and on the extra ) and the missing commas. There is one more culprit: column constraints in Oracle are written as two words, NOT NULL. The token Not_Null will not be recognized and can trigger the same ORA-00907 you are seeing. Also, avoid a trailing comma before the closing ).

If you want an Oracle-idiomatic version that also enforces basic rules, try this:

CREATE TABLE non_game (
  p_id      NUMBER(10)       NOT NULL,
  item_num  CHAR(4)          NOT NULL,
  description VARCHAR2(30),
  on_hand   NUMBER(4)        DEFAULT 0 NOT NULL,
  category  CHAR(3),
  price     NUMBER(6,2)      NOT NULL,
  CONSTRAINT non_game_pk PRIMARY KEY (p_id),
  CONSTRAINT non_game_on_hand_ck CHECK (on_hand >= 0),
  CONSTRAINT non_game_price_ck   CHECK (price >= 0)
);

Notes you can apply immediately:

  • NUMBER is the native type; DECIMAL and INT are accepted but map to NUMBER under the hood. Using NUMBER keeps things consistent.
  • Prefer VARCHAR2 over CHAR for text like description; CHAR pads with spaces and can surprise comparisons.
  • ORA-00907 often points near, not exactly at, the real error. As joked, the parser sometimes reports a missing ) when the problem is a stray comma or bad keyword earlier.

Quick debugging trick: create the table with 1–2 columns, then add the rest with ALTER TABLE ADD one at a time. When it breaks, you know exactly which line needs fixing.

Recommended Answers

All 5 Replies

Just a guess. Maybe it's the missing or extra comma's?

ORA-00907: missing right parenthesis

It's the double closing at the end, should be only one.

Seems bizarre that an extra R.P. is diagnosed as "missing" :)

JC, my bet is they added a R.P. to fix it. The commas look inconsistent, missing on the 2 lines on ON_Hand and maybe an extra on the last line.

Kinda wish they have formatted it so the lines had numbers.

Error messages from compilers and more have been misleading to hilarious for decades. How many of us have seen this? (all of us!)

I think I should have just pasted this in a code block. Here's what I think would work. Try it?

Create Table Non_Game
(
P_Id int Not_Null,
Item_Num Char(4) Not Null,
Description Char(30),
On_Hand Decimal(4,0),
Category Char(3),
Price Decimal(6,2)
)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.