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

Home -> Community -> Usenet -> c.d.o.tools -> Re: strange behavior of decode?

Re: strange behavior of decode?

From: Eric Givler <egivler_at_flash.net>
Date: 2000/08/11
Message-ID: <cDWk5.174$ic.17366@news.flash.net>#1/1

I can tell you...
to_char(sysdate,'Day') returns "Friday " Check it out: Select length(to_char(sysdate,'Day')) from dual and you get 9 This is because the longest day is: Wednesday which is 9 characters, and they
are all right padded to that length. Try an Rtrim() or an fm infront of Day.

Maurice Samuels <samuels_at_red.seas.upenn.edu> wrote in message news:8n1aoc$mnl$1_at_netnews.upenn.edu...
> can anyone explain to me why this does not work:
>
> select to_char(sysdate,'Day') from dual;
> output -> Friday
>
> select decode(to_char(sysdate,'Day'),'Friday',1,2) from dual;
> output -> 2
>
> why is the output not 1?
>
> if i do:
> select decode(to_char(sysdate,'Dy'),'Fri',1,2) from dual;
> output -> 1
>
> why does the decode work in this case but not the previous?
> any help would be much appreciated.
> -maurice
> samuels_at_seas.upenn.edu
Received on Fri Aug 11 2000 - 00:00:00 CDT

Original text of this message

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