Re: Returning a bool on DELETE in a proc. - Mailing list pgsql-sql

From Keith Worthington
Subject Re: Returning a bool on DELETE in a proc.
Date
Msg-id 20050118184623.M60170@narrowpathinc.com
Whole thread Raw
In response to Returning a bool on DELETE in a proc.  (KÖPFERL Robert <robert.koepferl@sonorys.at>)
List 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.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Robert,

I do not know what version you are working with but here is the 7.4
documentation on result status.

http://www.postgresql.org/docs/7.4/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

Kind Regards,
Keith

PS I am a novice myself so don't put too much faith in my post. ;-)

______________________________________________
99main Internet Services http://www.99main.com



pgsql-sql by date:

Previous
From: KÖPFERL Robert
Date:
Subject: Returning a bool on DELETE in a proc.
Next
From: Michael Fuhr
Date:
Subject: Re: Returning a bool on DELETE in a proc.