Re: simple? query - Mailing list pgsql-sql

From Jasen Betts
Subject Re: simple? query
Date
Msg-id h6390i$up9$3@reversiblemaps.ath.cx
Whole thread Raw
In response to simple? query  (Jan Verheyden <jan.verheyden@uz.kuleuven.ac.be>)
List pgsql-sql
On 2009-08-13, Jan Verheyden <jan.verheyden@uz.kuleuven.ac.be> wrote:
> --_004_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_
> Content-Type: multipart/alternative;
>     boundary="_000_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_"
>
> --_000_E30C7040DE22624185BAD4093190B54437BE5DB4C1EX2007MBX2uzk_
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> Hi,
>
> I was trying to run following query but doesn't work:
>
> if (uid='janvleuven10') then
>                 insert into test (registered) values ('1');
> else
>                 insert into test (registered) values ('0');
> end if;

that's not SQL. (it could be plpgsql)

if you need to do it in SQL do this.

insert into test (registered) values ( case when uid='janvleuven10' then '1' else '0' end );



pgsql-sql by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: mail alert
Next
From: Hengky Lie
Date:
Subject: Field or record level encryption / decryption