From oracle-l-bounce@freelists.org  Tue Jun 22 12:30:04 2004
Return-Path: <oracle-l-bounce@freelists.org>
Received: from air189.startdedicated.com (root@localhost)
 by orafaq.com (8.11.6/8.11.6) with ESMTP id i5MHTmc14380
 for <oracle-l@orafaq.com>; Tue, 22 Jun 2004 12:29:58 -0500
X-ClientAddr: 206.53.239.180
Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180])
 by air189.startdedicated.com (8.11.6/8.11.6) with ESMTP id i5MHTc614325
 for <oracle-l@orafaq.com>; Tue, 22 Jun 2004 12:29:48 -0500
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP
 id 7C55D72C290; Tue, 22 Jun 2004 12:13:17 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 27052-29; Tue, 22 Jun 2004 12:13:17 -0500 (EST)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP
 id 8BF6872C5A4; Tue, 22 Jun 2004 12:13:15 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Tue, 22 Jun 2004 12:11:48 -0500 (EST)
X-Original-To: oracle-l@freelists.org
Delivered-To: oracle-l@freelists.org
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id CCD5772C5E4
 for <oracle-l@freelists.org>; Tue, 22 Jun 2004 12:11:45 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 24217-69 for <oracle-l@freelists.org>;
 Tue, 22 Jun 2004 12:11:45 -0500 (EST)
Received: from ha-smtp3.tiscali.nl (smtp-b2c.tiscali.nl [195.241.80.19])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 97E4F72C59C
 for <oracle-l@freelists.org>; Tue, 22 Jun 2004 12:11:44 -0500 (EST)
Received: from LAPTOPLEX (82-168-217-228-bbxl.xdsl.tiscali.nl [82.168.217.228])
 by ha-smtp3.tiscali.nl (Postfix) with SMTP id 55E2B3161F9
 for <oracle-l@freelists.org>; Tue, 22 Jun 2004 19:33:09 +0200 (CEST)
From: "Lex de Haan" <lex.de.haan@naturaljoin.nl>
To: <oracle-l@freelists.org>
Subject: RE: Slow running Query.
Date: Tue, 22 Jun 2004 19:33:02 +0200
Message-ID: <JFEEIGBIDOCCDALDIPLNAENGCEAA.lex.de.haan@naturaljoin.nl>
MIME-Version: 1.0
Content-type: text/plain
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0)
Importance: Normal
In-Reply-To: <40D86A94.000003.02400@CACHITOSS>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Virus-Scanned: by amavisd-new at freelists.org
Content-Transfer-Encoding: 8bit
X-archive-position: 3334
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-To: oracle-l-bounce@freelists.org
X-original-sender: lex.de.haan@naturaljoin.nl
Precedence: normal
Reply-To: oracle-l@freelists.org
X-list: oracle-l
X-Virus-Scanned: by amavisd-new at freelists.org

Juan,
in your case you don't even need the nvl function -- because the result is
always 3.
the problem occurs with the empty set. check this out:

SQL> create table blah(c1 number);
Table created.

SQL> select nvl(sum(c1),0), sum(nvl(c1,0)) from blah;

NVL(SUM(C1),0) SUM(NVL(C1,0))
-------------- --------------
             0

SQL>

Kind regards,
Lex.

---------------------------------------------
visit my website at http://www.naturaljoin.nl <http://www.naturaljoin.nl>
---------------------------------------------



-----Original Message-----
From: oracle-l-bounce@freelists.org
[mailto:oracle-l-bounce@freelists.org]On Behalf Of Juan Carlos Reyes
Pacheco
Sent: Tuesday, June 22, 2004 18:21
To: oracle-l@freelists.org
Subject: RE: Slow running Query.


Hi Lex, why you say that, could you showme why please

I show you why I say is the same:
 SQL> select * from test;

      TEST
----------
         1

         2

Transcurrido: 00:00:00.00
SQL> select count(*) from test where test is null;

  COUNT(*)
----------
         1

Transcurrido: 00:00:00.00
SQL> select sum(nvl(test,0)) from test;

SUM(NVL(TEST,0))
----------------
               3

Transcurrido: 00:00:00.00
SQL> select nvl(sum(test),0) from test;

NVL(SUM(TEST),0)
----------------
               3

Transcurrido: 00:00:00.00


-------Original Message-------

From: oracle-l@freelists.org
Date: 06/22/04 12:43:39
To: oracle-l@freelists.org
Subject: RE: Slow running Query.

Juan,

unfortunately sum(nvl(column,0)) is not equivalent to nvl(sum(column),0)..

Kind regards,
Lex.

---------------------------------------------
visit my website at http://www.naturaljoin.nl
---------------------------------------------


-----Original Message-----
From: oracle-l-bounce@freelists.org
[mailto:oracle-l-bounce@freelists.org]On Behalf Of Juan Carlos Reyes
Pacheco
Sent: Tuesday, June 22, 2004 17:15
To: oracle-l@freelists.org
Subject: RE: Slow running Query.


Hi, I will do t he following


Try creating function indexes on composed columns you are queryin and tellme
if this improves something
For example you are using as_date in the where column, but you don't have a
index on substr(ca_date,1,4,....

Only to avoid unncesary plsql work
1. instead sum(nvl(column,0)) I'll use nvl(sum(column),0
2. instead of decode use case


-- Binary/unsupported file stripped by Ecartis --
-- Type: text/x-vcard
-- File: Lex de Haan.vcf


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------


-- Binary/unsupported file stripped by Ecartis --
-- Type: text/x-vcard
-- File: Lex de Haan.vcf


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

