Subject | Problem with insert without specifing value for DATE |
---|---|
Author | Sototh |
Post date | 2002-08-30T11:03:01Z |
Hello!
I have created table as follows:
CREATE TABLE POJEMNIK_CENA (
ID INTEGER NOT NULL,
ID_POJEMNIK INTEGER NOT NULL,
DATA DATE NOT NULL,
CENA NUMERIC(10,3),
VAT SMALLINT,
DATA_END DATE
);
ALTER TABLE POJEMNIK_CENA ADD CONSTRAINT PK_POJCEN_ID PRIMARY KEY (ID);
ALTER TABLE POJEMNIK_CENA ADD CONSTRAINT FK_POJCEN_POJ_ID FOREIGN KEY
(ID_POJEMNIK) REFERENCES POJEMNIK (ID);
Next, I tried to execute statement as follows:
INSERT INTO POJEMNIK_CENA (ID,
ID_POJEMNIK,
DATA,
CENA,
VAT)
VALUES (100,
1,
'2002-01-01',
12,
7);
There is a row with ID = 1 in table POJEMNIK (FK constraint isn't
violated) and a number 100 is unique value for ID in POJEMNIK_CENA.
Finally, I've got an error message:
Statement failed, SQLCODE = -625
validation error for column DATA_END, value "*** null ***"
Why does it happen? Is it necessary to specify all nullable colums? It
would be ugly... :((
I'd be grateful for any help.
greetings
Sototh
I have created table as follows:
CREATE TABLE POJEMNIK_CENA (
ID INTEGER NOT NULL,
ID_POJEMNIK INTEGER NOT NULL,
DATA DATE NOT NULL,
CENA NUMERIC(10,3),
VAT SMALLINT,
DATA_END DATE
);
ALTER TABLE POJEMNIK_CENA ADD CONSTRAINT PK_POJCEN_ID PRIMARY KEY (ID);
ALTER TABLE POJEMNIK_CENA ADD CONSTRAINT FK_POJCEN_POJ_ID FOREIGN KEY
(ID_POJEMNIK) REFERENCES POJEMNIK (ID);
Next, I tried to execute statement as follows:
INSERT INTO POJEMNIK_CENA (ID,
ID_POJEMNIK,
DATA,
CENA,
VAT)
VALUES (100,
1,
'2002-01-01',
12,
7);
There is a row with ID = 1 in table POJEMNIK (FK constraint isn't
violated) and a number 100 is unique value for ID in POJEMNIK_CENA.
Finally, I've got an error message:
Statement failed, SQLCODE = -625
validation error for column DATA_END, value "*** null ***"
Why does it happen? Is it necessary to specify all nullable colums? It
would be ugly... :((
I'd be grateful for any help.
greetings
Sototh