Skip to content
Advertisement

ORA-00922: missing or invalid option , can’t create tables

I’m trying to create some tables in Oracle LiveSQL and I’m getting ORA-00922: missing or invalid option but I can’t figure it out why it doesn’t work; here is the code(the comments stand for the tables in the relational model).I apologize for eventual stupid mistakes, I’m a complete beginner of SQL programming.

Advertisement

Answer

  1. You need to terminate each statement with ;
  2. Oracle does not have a boolean SQL data type. You can use di_persona NUMBER(1) CHECK (di_persona IN (1, 0)) instead.
  3. desc is a reserved word and cannot be used as an identifier; if it as an abbreviation for “description” then you can use descr instead.
  4. You cannot use a subquery in a CHECK constraint.
  5. Oracle does not have a time data type. You can use INTERVAL DAY(0) TO SECOND instead; or, if data and ora are supposed to be a combined date and time then just use the data column as the DATE data type always has year, month, day, hour, minute and second components so you do not need a separate time column.

db<>fiddle here

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