Returning a bool on DELETE in a proc.

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Returning a bool on DELETE in a proc.
Date: 2005-01-18 16:04:58
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB16564@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I'm currently writing a function which encapsulates a delete and should
return a bool as indicator for success.

I tried:

DELETE FROM "TariffDetails" WHERE "TariffId"=$1 and "BNumberPrefix"=$2;
SELECT TRUE;

but this makes me not happy.
How can I distingruish wehter DELETE affected 0 or more rows and return that
while DELETE is not capable of returning any value?

And is the whole function executed if the DELETE fails or will it stop
bevore the select?

I had a read throu SQL-functions while nothing matched me.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message KÖPFERL Robert 2005-01-18 16:17:49 Re: query configuration for validate empty quote to zero
Previous Message Achilleus Mantzios 2005-01-18 15:05:55 mail + rfc822, rfc2822 + schema