🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11023

How to deferre constraints during inserting in IB6

#11023
From: Mike Hendzel
Date: Thu, 26 Dec 2002 15:10
35 lines
2084 bytes
Let`s say we have such that DB:

CREATE TABLE Docs
(
number        CHAR(9)  NOT NULL PRIMARY KEY,
id            CHAR(11) NOT NULL UNIQUE,
purchase_date DATE
);

CREATE TABLE Persons
(
id      CHAR(11) NOT NULL PRIMARY KEY,
number  CHAR(9)
        CONSTRAINT FK_PERSONS_DOCS NOT NULL UNIQUE
                                          REFERENCES docs(number),
name    VARCHAR(20),
surname VARCHAR(20)
);

ALTER TABLE Docs
      ADD CONSTRAINT FK_DOCS_PERSONS
                  FOREIGN KEY(id)
                  REFERENCES persons(id);
-------------------------------------------------------------------
Now if I want to add some data like:
    INSERT INTO Dowody VALUES('23','79010500873',CAST( '26.12.2002' AS
DATE ) )

There is an SQL error:
    Violation of FOREIGN KEY constraint "FK_DOWOD_OSOBA" on table "DOWODY"
    Statement: INSERT INTO Dowody VALUES('23','79010500873',CAST(
'26.12.2002' AS                 DATE ) )

Anyone knows how to deferre constraints such like in SQL-92 standard, or
how to solve this problem without dropping constraints ?
Technical Details
Message-ID: <3e0b1b97$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!canoe.uoregon.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,ddd774cf71b3ee9,start
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-26 07:12:25 PST
From: "Mike Hendzel" <castorek@priv.ckp.pl>
Newsgroups: borland.public.interbase.sql
Subject: How to deferre constraints during inserting in IB6
Date: Thu, 26 Dec 2002 16:10:42 +0100
Lines: 37
Organization: University of Technology of Wroclaw Poland
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 213.77.64.176
Message-ID: <3e0b1b97$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040915351 213.77.64.176 (26 Dec 2002 07:09:11 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!canoe.uoregon.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail