db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Eder <lukas.e...@gmail.com>
Subject Re: Decode function as that in Oracle
Date Mon, 21 Feb 2011 12:26:44 GMT
>
> Below query works in oracle.
> Is there equivalent in Derby?
> Update myTable set COL_1 = decode(COL_1,null,'Null', 'Mamatha') where key
> ='M9621'
>

In most SQL dialects, you can use the CASE statement, i.e. something like
this

UPDATE myTable
SET COL_1 =
  (CASE WHEN COL_1 IS NULL THEN 'Null' ELSE 'Mamatha' END)
WHERE KEY = 'M9621'

Mime
View raw message