Article View: borland.public.interbase.sql
Article #269Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5
From: Quinn Wildman (CodeGear Develope...
Date: Fri, 08 Feb 2008 16:45
Date: Fri, 08 Feb 2008 16:45
99 lines
3484 bytes
3484 bytes
For InterBase 2007, do you have SP2? Kjell Ljungqvist wrote: > I entered this report into QC a few days ago (57839). No comments have been > made there yet so I thought I would like to here from you guys here in the > NG. Any comments on this? This change in behaviour between IB2007 and > earlier versions of IB (tested with IB 7.5 and IB 5.6) has caused as a > number of unpleasent experiences already. > > When using "left join" to a stored proc in a select statement with IB 2007 > the result set differs (see the NULL values in section 4 below) from the > result set that IB 7.x and IB 5.6 gives. In the example given here it seems > like only the last record in the dataset contains the correct information > from the SP. Hence queries that give only one record back are correct in IB > 2007 too (section 5 below). > > Regards, > Kjell > > * * * * * > > 1. TABLE AND SP SETUP > ------------------------------------------- > CREATE TABLE TEST_DATA ( > ID INTEGER NOT NULL, > QTY INTEGER, > QTY2 INTEGER > ); > > ALTER TABLE TEST_DATA ADD CONSTRAINT PK_TEST_DATA PRIMARY KEY (ID); > > CREATE PROCEDURE IS_EQUAL( > PLINK_ID INTEGER, > PVALUE1 INTEGER, > PVALUE2 INTEGER > ) > RETURNS ( > R_LINK_ID INTEGER, > R_EQUAL CHAR(1) > ) > AS > BEGIN > R_LINK_ID=PLINK_ID; > if (PVALUE1=PVALUE2) then > R_EQUAL='T'; > else > R_EQUAL='F'; > suspend; > end > > > 2. TESTDATA > ------------------------- > INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (1, 0, 0); > INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (2, 1, 0); > INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (3, 0, 1); > > > 3. QUERY > ----------------- > select * from TEST_DATA T > LEFT JOIN IS_EQUAL(T.ID,T.QTY,T.QTY2) CD > ON CD.R_LINK_ID=T.ID > > > 4. RESULTS > --------------------- > IB 2007: > ID QTY QTY2 R_LINK_ID R_EQUAL > 1 0 0 NULL NULL > 2 1 0 NULL NULL > 3 0 1 3 F > > > IB 7.5 > ID QTY QTY2 R_LINK_ID R_EQUAL > 1 0 0 1 T > 2 1 0 2 F > 3 0 1 3 F > > > 5. SINGLETON QUERY > -------------------------------------- > select * from TEST_DATA T > LEFT JOIN IS_EQUAL(T.ID,T.QTY,T.QTY2)CD ON CD.R_LINK_ID=T.ID > where T.ID=2 > > IB 2007: > ID QTY QTY2 R_LINK_ID R_EQUAL > 2 1 0 2 F > > IB 7.5 > ID QTY QTY2 R_LINK_ID R_EQUAL > 2 1 0 2 F > > > * * * * * > >
Technical Details
Message-ID:
<47ac873d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47ab755a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,6d404279065eef77 X-Google-Attributes: gid114a0e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 08 Feb 2008 08:45:26 -0800 From: "Quinn Wildman (CodeGear Developer Support)" <qwildman@nospam.codegear.com> User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5 References: <47ab755a@newsgroups.borland.com> In-Reply-To: <47ab755a@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 10.143.100.209 Message-ID: <47ac873d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1202489149 10.143.100.209 (8 Feb 2008 08:45:49 -0700) Lines: 99 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail