🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Stored Procedures and Constraints

#11329
From: Bill Todd
Date: Wed, 27 Nov 2002 18:28
33 lines
2034 bytes

On Wed, 27 Nov 2002 10:12:36 -0600, "Eric Lewis"
<elewis@highergear.com> wrote:

>IB 6.0 - NT2000
>
>I have a Stored procedure that calls two other SPs. The first called
>procedure gets a generated number, inserts a new record into table "A" with
>that number, and passes the number back to the calling procedure. Then the
>next procedure called takes that number and inserts a new record into table
>"B" that has a constraint stating a Foreign Key related to table "A".
>
>When running the main procedure the following error occurs:
>
>violation of FOREIGN KEY constraint "VALUE_HAS_VALUE" on table "B"
>
>It seems to me that table "A" does not get a commit. So, the values do not
>exist for the constraint to validate.

As long as the master record and the detail record are inserted in the
same transaction it should work. Before you commit the transaction
SELECT the new record in the master table and you should see it.

>
>Any suggestions?
>
>Thanks for your time.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Technical Details
Message-ID: <0h3auug2iogvd466pjfsjr74kqc80o4ffb@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3de4eeff$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,a909d41206a87b91
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-11-27 10:47:52 PST
From: Bill Todd <bill@notthis.dbginc.com>
Newsgroups: borland.public.interbase.sql
Subject: Re: Stored Procedures and Constraints
Date: Wed, 27 Nov 2002 11:28:09 -0700
Message-ID: <0h3auug2iogvd466pjfsjr74kqc80o4ffb@4ax.com>
References: <3de4eeff$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.207.211.30
X-Trace: newsgroups.borland.com 1038421689 216.207.211.30 (27 Nov 2002 10:28:09 -0800)
Lines: 33
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail