Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: group by for column of type date

Re: group by for column of type date

From: Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl>
Date: Thu, 28 Nov 2002 09:34:33 +0100
Message-ID: <l7lbuus1vol10r03jqju6kvj59id80ieqi@4ax.com>


On Thu, 28 Nov 2002 08:28:49 +0100, Michael Howitz <mhowitz_at_firemail.de> wrote:

>Niall Litchfield wrote:
>[..]
>> The original question was about grouping by date. Group by
>> trunc(date_column) will group all rows from the same day together, it is
>> more efficient (for the reasons Alex gives though I do wonder how big the
>> performance impact actually is), Your test seems just to show that the
>> *presentation* of the date is different dependent upon NLS_LANG.
>
>yes, but that's my problem. when i want to use TRUNC in the GROUP BY
>clause I also have to use it in the SELECT clause which I can't do.
>i have to traverse the result in my host lauguage PHP4. the problem is
>that not for each day exists an entry so i have to generate all dates
>using php4 and then compare them to the result of the database. I think
>that this has higher performance than firing an sql-statement for each day.
>
>so it seems that i have to use TO_CHAR although it is slow and so on.
>... or is there a way to set NLS_LANG at runtime for the session?

alter session set nls_date_format = '<any date string>' should do.

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Thu Nov 28 2002 - 02:34:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US