Using a case within a simple update
From: Sashi <smalladi_at_gmail.com>
Date: Thu, 15 Oct 2009 08:21:19 -0700 (PDT)
Message-ID: <563d1b45-2b9d-4f22-a82d-51fc17806437_at_k33g2000yqa.googlegroups.com>
Hi all, I'm trying to do something like this.
Date: Thu, 15 Oct 2009 08:21:19 -0700 (PDT)
Message-ID: <563d1b45-2b9d-4f22-a82d-51fc17806437_at_k33g2000yqa.googlegroups.com>
Hi all, I'm trying to do something like this.
update myTable
case length(duration)
when 8 then set hours = substr(duration,1,2)
else set hours = substr(duration,1, 1)
end case
Depending on the length of the 'duration' field, I'm trying to extract either the first or the first two characters. It ain't workin'.
Is such a construct possible withing pl/sql? The few examples that I've googled around give easy options for using it within a select but no examples within an update.
Thanks,
Sashi
Received on Thu Oct 15 2009 - 10:21:19 CDT