🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Join - understand strange results

#375
From: Adalberto Baldini
Date: Thu, 24 Apr 2008 15:31
53 lines
3191 bytes
----- Original Message ----- 
From: "Wayne Niddery (TeamB)" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
Sent: Wednesday, April 23, 2008 9:29 PM
Subject: Re: Join - understand strange results


> That definitely is a puzzle, it looks like the data must be right, so 
> possibly there's a bug somewhere.

select distinct  a.abinp, a.fil , b.abinp, b.fil, b.ambname, b.filname,
b.aut_input, b.aut_celur
from giocoge a
left join  ABFL_USRSOCINP_UNO (:UTENTE, a.csoc, a.nreserc, a.abinp, a.fil) b
on (b.abinp = a.abinp and b.fil = a.fil )

Returns right data only for record that has  a.abinp = '' and a.fil = ''.
 for other records that have value in these fields procedure return nothing.

if I add     where not (a.abinp = '' and a.fil = '')
same result.

>Is the stored proc properly calling SUSPEND to return a result set rather 
>than a single set of return values? (Even if it is designed to always 
>return just one record, if you are going to use it as part of a select 
>statement it must call SUSPEND as far as I know).

I modified Proc to have only one select and suspend.
It has not  a for do loop.

> What happens if you, using IBConsole or ISQL, simply select directly from 
> the stored procedure passing various parameters? Do you always get correct 
> returns?

select distinct  b.abinp, b.ambname, b.fil, b.filname, b.aut_input,
b.aut_celur
from  ABFL_USRSOCINP_UNO (:UTENTE, :csoc, :nreserc, :abinp, :fil) b

passing values that above examples don't work, in this case work fine.

test values :

abinp             fil
''                    ''                         ok!
ABIT            DETO                 ok!
ABIT            MASC                ok!

as I already said   using clause
left join  ABFL_USRSOCINP_UNO (:UTENTE, a.csoc, a.nreserc, a.abinp, a.fil) b
on (1=1)
works fine.

Adalberto Baldini
Technical Details
Message-ID: <4810a7dd@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <480c85b4$1@newsgroups.borland.com> <480ca9f3$1@newsgroups.borland.com> <480e09f4$1@newsgroups.borland.com> <480f8e10$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,11ad783c403646e4
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Adalberto Baldini" <finman@swissonline.ch>
From: "Adalberto Baldini" <finman@swissonline.ch>
Newsgroups: borland.public.interbase.sql
References: <480c85b4$1@newsgroups.borland.com> <480ca9f3$1@newsgroups.borland.com> <480e09f4$1@newsgroups.borland.com> <480f8e10$1@newsgroups.borland.com>
In-Reply-To: <480f8e10$1@newsgroups.borland.com>
Subject: Re: Join - understand strange results
Date: Thu, 24 Apr 2008 17:31:36 +0200
Lines: 54
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16480
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545
NNTP-Posting-Host: 85.7.232.224
Message-ID: <4810a7dd@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1209051101 85.7.232.224 (24 Apr 2008 08:31:41 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail