double not null constraints

Track changes to Oracle schemas in your existing version control system.

Moderators: eddie davis, richardjm, Michael Christofides, neil.anderson

double not null constraints

Postby sfrade » Wed Dec 18, 2013 8:22 am

Hi

the code generated by Source control create a constraint NOT NULL and a CHECK (xxx IS NOT NULL) for the same field.

see the field titi_name in the code below
Code: Select all
CREATE TABLE unified.titi (
  titi_id RAW(16) DEFAULT SYS_GUID() NOT NULL,
  titi_name VARCHAR2(50 BYTE) NOT NULL CONSTRAINT nn_titi_tina CHECK ("TITI_NAME" IS NOT NULL),
  CONSTRAINT titi_pk PRIMARY KEY (titi_id)
);


Seb
sfrade
 
Posts: 6
Joined: Tue Dec 17, 2013 2:07 pm

Postby eddie davis » Thu Dec 19, 2013 3:10 pm

Hi

I understand the problem, I believe it to be caused in the method that Oracle creates the metadata information.

Although you create your SQL script as follows:
Code: Select all
CREATE TABLE TITI
(
TITI_ID RAW(16) DEFAULT SYS_GUID(),
TITI_NAME VARCHAR2(50 BYTE) CONSTRAINT NN_TITI_TINA NOT NULL,
CONSTRAINT TITI_PK PRIMARY KEY (TITI_ID)
);


Oracle is storing the metadata information as follows:
Code: Select all
CREATE TABLE unified.titi (
titi_id RAW(16) DEFAULT SYS_GUID() NOT NULL,
titi_name VARCHAR2(50 BYTE) NOT NULL CONSTRAINT nn_titi_tina CHECK ("TITI_NAME" IS NOT NULL),
CONSTRAINT titi_pk PRIMARY KEY (titi_id)
);


As Source Control for Oracle will read how the table is created from the metadata, hence the difference.

Does this cause a problem for you?

A support ticket has been created for you HERE.

Many Thanks
Eddie
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
eddie davis
 
Posts: 943
Joined: Wed Jun 14, 2006 3:47 pm
Location: Red Gate Software


Return to Source Control for Oracle

Who is online

Users browsing this forum: No registered users and 0 guests