Article View: borland.public.interbase.sql
Article #270Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5
From: Kjell Ljungqvist
Date: Fri, 08 Feb 2008 17:52
Date: Fri, 08 Feb 2008 17:52
105 lines
3808 bytes
3808 bytes
Yes. The results below are with IB 2007 SP2. /Kjell "Quinn Wildman (CodeGear Developer Support)" <qwildman@nospam.codegear.com> wrote in message news:47ac873d$1@newsgroups.borland.com... > 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:
<47ac96dc@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!83.128.0.11.MISMATCH!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!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> <47ac873d$1@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 From: "Kjell Ljungqvist" <kjell@REMOVETHIS.iki.fi> Newsgroups: borland.public.interbase.sql References: <47ab755a@newsgroups.borland.com> <47ac873d$1@newsgroups.borland.com> Subject: Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5 Date: Fri, 8 Feb 2008 19:52:25 +0200 Lines: 106 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 213.250.81.14 Message-ID: <47ac96dc@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1202493148 213.250.81.14 (8 Feb 2008 09:52:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!83.128.0.11.MISMATCH!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail