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

Home -> Community -> Usenet -> c.d.o.server -> is there a bug in decode function with respect to date

is there a bug in decode function with respect to date

From: Madhuri Bannai <bannai_at_prodigy.net>
Date: 2000/03/15
Message-ID: <8apljm$n02$1@newssvr03-int.news.prodigy.com>#1/1

Hi,

Could any one explain the out put of the set os statements to me. Is there a bug in decode function ?

drop table test_ajay;

create table test_ajay ( col1 date );

insert into test_ajay values ( to_date('01-feb-1982','dd-mon-yyyy'));

select * from test_ajay;

select to_char(col1,'MM-DD-YYYY') from test_ajay;

select
to_char(to_date(decode(col1,'01-feb-00',null,col1,col1),'dd-mon-yy'),'MM-DD- YYYY') from test_ajay;

The out put looks like

SQLWKS> drop table test_ajay;

Statement processed.

SQLWKS> create table test_ajay ( col1 date );

Statement processed.

SQLWKS> insert into test_ajay values
 to_date('01-feb-1982','dd-mon-yyyy'));

1 row processed.

SQLWKS> select * from test_ajay;

COL1


01-FEB-82 1 row selected.

SQLWKS> select to_char(col1,'MM-DD-YYYY') from test_ajay;

TO_CHAR(CO


02-01-1982

1 row selected.

SQLWKS> select
to_char(to_date(decode(col1,'01-feb-00',null,col1,col1),'dd-mon-yy'),'MM-DD- YYYY') from test_ajay;

TO_CHAR(TO


02-01-2082

1 row selected.

SQLWKS>


This one drove us nuts when we did some bulk data load from a main frame dump into oracle tables. Received on Wed Mar 15 2000 - 00:00:00 CST

Original text of this message

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