sql - alternate use of the CASE on table UPDATE -
this works:
update keyboard_learning set a.date_completed = case when a.date_completed = '04-jul-2012' '06-jul-2012' end a.emplid = 18
but won't(below). error datatypes don't match, , of course makes sense because 1 date datatype , other number.
update keyboard_learning set a.date_completed = case a.date_completed when '04-jul-2012' '06-jul-2012' end a.emplid = 21
my question: there workaround make second way work place column name 'a.date_completed' in case line of sql instead of how got working first way? off on syntax second sql?
convert date_completed
string in case statement.
try this:
update keyboard_learning set a.date_completed = case to_char(a.date_completed, 'dd-mon-rrrr') when '04-jul-2012' to_date('06-jul-2012','dd-mon-rrrr') end a.emplid = 21
Comments
Post a Comment