Search code examples
sqloracle-databasealter-tablesqlfiddle

What constraint is being violated?


I am trying to write an alter table statement in Oracle and using SQLFiddle to test it and am getting a very vague error, so looking for help here. SQLFiddle did find two other errors for me so I assume the error I am seeing is valid.

Here is the table:

CREATE TABLE Space (
  uri                  varchar(255) NOT NULL PRIMARY KEY,
  etag                 varchar(16) NOT NULL,
  title                VARCHAR2(255),
  description          VARCHAR2(4000),
  dependencyResource   varchar(255)
)

Here is the alter table statement:

ALTER TABLE Space
ADD detectConflict NUMBER(1, 0) DEFAULT 0 NOT NULL

Here is the error I see:

ORA-02091: transaction rolled back ORA-02290: check constraint (SYSTEM.DEFERRED_4_D0560_CK) violated

Link to SQLFiddle: http://sqlfiddle.com/#!4/d0560/2


Solution

  • Looks like it was a mistake in my understanding of how SQLFiddle works. Mihai pointed out that DDL statements need to all be on the left side.