Re: Date Trigger Needed

From: Steve Cosner <stevec_at_zimmer.CSUFresno.EDU>
Date: 1996/08/14
Message-ID: <4utj7n$om4_at_zimmer.CSUFresno.EDU>#1/1


In article <01bb897f$3f335040$747ba3ce_at_BillLong.teleport.com>, Bill Long <billlong_at_teleport.com> wrote:
>I need the SQL*PLUS code for the date conversion (I will it into a
>trigger) that will translate dates (both ways) between '12/31/96' and
>'31-DEC-96' formats.
>
>I know I can write this code. It would make my life easier if I could find
>existing, really complete routines.

Ok Bill, I can't resist taking a shot at this....

Procedure Conv_Date (Dstring in out varchar2) is Begin
  If substr(Dstring,3,1) = '/' then
    Dstring := To_Char( To_Date( Dstring,'MM/DD/RR'),'DD-MON-YY');   Elsif substr(Dstring,3,1)='-' then
    Dstring := To_Char( To_Date( Dstring,'DD-MON-RR'),'MM/DD/YY');   Else
    Dstring := Null;
  End If;
Exception
  When others then Dstring := Null;
End;

This is untested stuff off the top of my head, so beware, you get what you pay for...

Steve Cosner Received on Wed Aug 14 1996 - 00:00:00 CEST

Original text of this message