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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: nls_date_format in 8.1.6

Re: nls_date_format in 8.1.6

From: Jan Pruner <jan_at_pruner.cz>
Date: Sat, 05 Jan 2002 08:07:05 -0800
Message-ID: <F001.003E7D33.20020105074018@fatcity.com>

Hmm, try to replace - if (t_date < '12-12-2001') with - if (t_date < to_date('12-12-2001','dd-mm-yyyy'))

Jan Pruner

On Sat 5. January 2002 13:35, you wrote:
> we have set nls_date_format to dd-mm-yyyy in parameter file .
>
> but all the funtions which have some hard coded date value in the format of
> dd-mm-yyyy
> are giving "not a valid month error"
>
> example is
> create or replace function test_bkj(t_date date)
> return varchar2
> is
> begin
> if (t_date < '12-12-2001')
> then
> t_retval := 'Less Than';
> else
> t_retval := 'Greater Than';
> end if;
> return t_retval;
> end;
>
> SQL> select test_bkj('12-12-2001') from dual;
> select test_bkj('12-12-2001') from dual
> *
> ERROR at line 1:
> ORA-01843: not a valid month
> ORA-06512: at "AVLMKT.TEST_BKJ", line 6
> ORA-06512: at line 1
>
> when we change the date format in funtion to 'dd/MON/yyyy' keeping the
> nls_date_format to 'dd-mm-yyyy'
> we are getting wrong results from function .
> create or replace function test_bkj(t_date date)
> return varchar2
> is
> begin
> if (t_date < '12-DEC-2001')
> then
> t_retval := 'Less Than';
> else
> t_retval := 'Greater Than';
> end if;
> return t_retval;
> end;
>
> SQL> select test_bkj('31-12-2001') from dual;
>
> TEST_BKJ('31/12/2001')
> ---------------------------------------------------------------------------
>- ----
> Less Than
>
> while the results should have been "Greater than" . ............(pl see the
> if-else condition )
> its giving "Less Than" for any date comparison.
>
> Pl help .
>
> Thanks in advance
>
> Brajesh Jaiswal

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jan Pruner
  INET: jan_at_pruner.cz

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Sat Jan 05 2002 - 10:07:05 CST

Original text of this message

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