Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 11317 invoked from network); 22 Feb 2011 07:44:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Feb 2011 07:44:21 -0000 Received: (qmail 27772 invoked by uid 500); 22 Feb 2011 07:44:20 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 27503 invoked by uid 500); 22 Feb 2011 07:44:17 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 27460 invoked by uid 99); 22 Feb 2011 07:44:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Feb 2011 07:44:16 +0000 X-ASF-Spam-Status: No, hits=2.9 required=5.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [59.145.150.86] (HELO mail7.ness.com) (59.145.150.86) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Feb 2011 07:44:09 +0000 Received: from inblrnt11.ness.com ([192.168.105.65]) by mail7.ness.com with ESMTP; 22 Feb 2011 13:12:41 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CBD264.64E2C388" Subject: RE: Decode function as that in Oracle Date: Tue, 22 Feb 2011 13:12:41 +0530 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Decode function as that in Oracle Thread-Index: AcvRwuqnaY8hxWxKTJar/2KKvxB5+AAoR8Vg References: From: "Mamatha Kodigehalli Venkatesh" To: "Lukas Eder" , "Derby Discussion" This is a multi-part message in MIME format. ------_=_NextPart_001_01CBD264.64E2C388 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you so much, It works!! =20 ________________________________ From: Lukas Eder [mailto:lukas.eder@gmail.com]=20 Sent: Monday, February 21, 2011 5:57 PM To: Derby Discussion Cc: Mamatha Kodigehalli Venkatesh Subject: Re: Decode function as that in Oracle =20 Below query works in oracle. Is there equivalent in Derby? Update myTable set COL_1 =3D decode(COL_1,null,'Null', 'Mamatha') where = key =3D'M9621' =20 In most SQL dialects, you can use the CASE statement, i.e. something = like this UPDATE myTable=20 SET COL_1 =3D=20 (CASE WHEN COL_1 IS NULL THEN 'Null' ELSE 'Mamatha' END)=20 WHERE KEY =3D 'M9621' ------_=_NextPart_001_01CBD264.64E2C388 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Thank you so much, It = works!!

 


From: Lukas = Eder [mailto:lukas.eder@gmail.com]
Sent: Monday, February = 21, 2011 5:57 PM
To: Derby Discussion
Cc: Mamatha Kodigehalli = Venkatesh
Subject: Re: Decode = function as that in Oracle

 

Below query works in oracle.
Is there equivalent in Derby?
Update myTable set COL_1 =3D decode(COL_1,null,'Null', 'Mamatha') where = key =3D'M9621'

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

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

------_=_NextPart_001_01CBD264.64E2C388--