Re: Using case in an update statement ?

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Peter Alberer" <peter(at)alberer(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Using case in an update statement ?
Date: 2002-06-05 15:28:28
Message-ID: web-1499913@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Peter,

> update lr_object_usage set status = (case when status = ''OPEN_SUCC''
> then ''CLOSED_SUCC'' when status = ''OPEN_FAIL'' then
> ''CLOSED_FAIL'');

You're missing something:

update lr_object_usage set status = (case when status = ''OPEN_SUCC''
then ''CLOSED_SUCC'' when status = ''OPEN_FAIL'' then
''CLOSED_FAIL'' END);

FYI, in the future, please e-mail the error you get as well as your
question. It helps us diagnose the problem.

-Josh Berkus

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Manfred Koizar 2002-06-05 16:30:08 Re: Using case in an update statement ?
Previous Message tdn 2002-06-05 15:07:59 date conversions