Re: Using a case within a simple update

From: Sasikanth Malladi <skm.sa100_at_gmail.com>
Date: Thu, 15 Oct 2009 19:48:01 -0700 (PDT)
Message-ID: <b81bbe08-27a5-4604-8e52-bb8191039cee_at_p4g2000yqm.googlegroups.com>



On Oct 15, 11:28 am, Maxim Demenko <mdeme..._at_gmail.com> wrote:
>
> update mytable set hours=case when length(duration)=8 then
> substr(duration,1,2) else substr(duration,1,1) end
>
> or shorter
>
> update mytable set
> hours=decode(length(duration),8,substr(duration,1,2),substr(duration,1,1))
>
> (assuming you wish update all rows in your table)
> Best regards
>
> Maxim

Great! Thank you!
Sashi
Sashi Received on Thu Oct 15 2009 - 21:48:01 CDT

Original text of this message