Re: Converting Strings w/different date-like formats

From: Saad Ahmad <sahmad_at_mfa.com>
Date: 19 Dec 1994 19:01:15 GMT
Message-ID: <3d4l9r$dbv_at_homer.alpha.net>


Andrew McConnell (mcconnel_at_source.asset.com) wrote:

> I've inherited a data model that has date information stored in
> varchar2 fields. I want to convert them all to date formats - but I
> have a problem.... Surprise! The formats for the strings are
> inconsistent, more specifically:
> Row 1: 11-NOV-94
> Row 2: 20-FEB-1993
> My select stmt:
> 'select to_date(subscription_date'DD-MON-YY') from test'

try this:
  select decode( length(subscription_date),9,

                     to_date(subscription_date'DD-MON-YY'),
                     to_date(subscription_date'DD-MON-YYYY') )
  from test;
--
**************************************************************
*                          Saad Ahmad                        *
*                          E-Mail: sahmad_at_mfa.com            *
**************************************************************
Received on Mon Dec 19 1994 - 20:01:15 CET

Original text of this message