Delete function

Started by Secrétariatover 21 years ago2 messagesgeneral
Jump to latest
#1Secrétariat
ets@rolland-fr.com

Hello !

I create a delete function :
CREATE FUNCTION delalpha(varchar, integer) RETURNS boolean
AS 'DELETE FROM public.params WHERE soc = $1 AND numpar = $2 ;
SELECT TRUE ;'
LANGUAGE sql ;
Is there a way to return the number of deleted row ?
Thanks.

Luc

#2Richard Huxton
dev@archonet.com
In reply to: Secrétariat (#1)
Re: Delete function

Secr�tariat wrote:

Hello !

I create a delete function :
CREATE FUNCTION delalpha(varchar, integer) RETURNS boolean
AS 'DELETE FROM public.params WHERE soc = $1 AND numpar = $2 ;
SELECT TRUE ;'
LANGUAGE sql ;
Is there a way to return the number of deleted row ?
Thanks.

If you rewrote the function in plpgsql, you could use "GET DIAGNOSTICS"
- see the manual plpgsql/Obtaining the result status.

--
Richard Huxton
Archonet Ltd