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: Expression needed

Re: Expression needed

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 30 Jul 2004 12:05:06 -0700
Message-ID: <2687bb95.0407301105.480f5be6@posting.google.com>


"MAB" <bad-email_at_nowhere.com> wrote in message news:<2mv4i5Frkl64U1_at_uni-berlin.de>...
> What's the expression to convert strings of the type '28-JUL-04' to
> '2004/07/28' ?
>
> thx

Well you could convert the string to a date via to_date and then convert the date to character string via to_char something like

UT1 > select to_char(to_date('28-Jul-04'),'YYYY/MM/DD') from dual;

TO_CHAR(TO



2004/07/28

Or since you have a string to begin with and just want to rearrange it you could use substr and concatenation, but if the data is a date then conversion to and back from a date is best. If the data is stored as an Oracle date datatype then you can output in just abount any format desired using to_char and a date format mask.

HTH -- Mark D Powell -- Received on Fri Jul 30 2004 - 14:05:06 CDT

Original text of this message

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