> 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