On 2009-08-13, Jan Verheyden <jan.verhey...@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 ); -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql