Inserting or Deleting conditionally

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Inserting or Deleting conditionally
Date: 2005-01-17 15:25:59
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB16561@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

coming from imperative programming paradigma, I'm currently trying to
express something like that in _SQL_:

It should be atomic and like an API for a user. I'm therefore writing
functions:

CRETE FUNC...

c := SELECT x,y,z FROM table_a WHERE...
IF COUNT(c)=1 then
INSERT / DELETE ... WHERE x = c.x
ENDIF

LANGUAGE SQL;

How is this correctly formulated? Or is there no other way than PL/xxx?

Thanks

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-01-17 16:02:46 Re: Inserting or Deleting conditionally
Previous Message KÖPFERL Robert 2005-01-17 12:48:49 Re: Record type in sql