Article View: borland.public.interbase.sql
Article #347Re: debug stored procedures
From: Isaac
Date: Tue, 20 May 2008 23:01
Date: Tue, 20 May 2008 23:01
28 lines
2163 bytes
2163 bytes
Quinn Wildman (CodeGear Developer Support) wrote: > I don't understand why you even need coalesce here. NULL's do not effect > SUM. Let's consider a trivial example > > create table t1 (f1 float); > insert into t1 values (NULL); > insert into t1 values (1.2); > insert into t1 values (2.3); > > Now, we know that NULL + 1.2 + 2.3 = NULL. However, select sum(f1) from > t1 returns 3.5. Isn't that what you want? > > Isaac wrote: >> I think I found another bug or a defect that I cant use SUM with COALESCE >> >> I tried SUM(COALESCE(QTY, cast(0 AS FLOAT))) >> >> and get this error: >> Unsuccessful execution caused by system error that does not preclude >> successful execution of subsequent statements. >> data type not supported for arithmetic. no I introduced this sql as a part of a stored procedure contain many selects some tables are empty so if one table is empty it will return null and in my final equation ex: e = table_1_result_value (5) + table_1_result_value (20) + table_1_result_value (null) = NULL not (25) I will go and use IFs for now
Technical Details
Message-ID:
<4833584b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4831f162@newsgroups.borland.com> <483340f3$1@newsgroups.borland.com> <4833500a@newsgroups.borland.com> <483355b3$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,8feff649be448d0 X-Google-Attributes: gid114a0e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 21 May 2008 02:01:27 +0300 From: Isaac <no@no.com> User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: Re: debug stored procedures References: <4831f162@newsgroups.borland.com> <483340f3$1@newsgroups.borland.com> <4833500a@newsgroups.borland.com> <483355b3$1@newsgroups.borland.com> In-Reply-To: <483355b3$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 41.234.198.61 Message-ID: <4833584b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1211324491 41.234.198.61 (20 May 2008 16:01:31 -0700) Lines: 28 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail