Re: triggers problems whit function

From: MOLINA BRAVO FELIPE DE JESUS <felipe(dot)molina(at)inegi(dot)org(dot)mx>
To: "Ma(dot) Cristina" Peña "C(dot)" <mpena(at)sensacd(dot)com(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: triggers problems whit function
Date: 2008-10-22 21:15:43
Message-ID: 1224710143.7448.11.camel@fjmb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


El mié, 22-10-2008 a las 15:01 -0500, Ma. Cristina Peña C. escribió:
> I want to use a function in to a trigger
>
>
>
> This is my
>
> CREATE FUNCTION "subradio"(integer) RETURNS integer AS 'select
> cast(count (claveubica) as integer ) from asradios where ubicacion
> =0;' LANGUAGE 'sql';
>
>
>
> And my ttrigger is
>
> CREATE TRIGGER validaradios AFTER DELETE ON subestacion FOR EACH ROW
> EXECUTE PROCEDURE subradio(0);
>
>
>
> But I got an error
>
> ERROR: CreateTrigger: function subradio() does not exist
>
>
>
> What can I do??

write your function in plpgsql

http://www.postgresql.org/docs/8.3/interactive/plpgsql-trigger.html

>
>
>
>
>
> cid:image002(dot)jpg(at)01C8F24F(dot)E2D90230
>
> Ing. María Cristina Peña C.
>
> Analista Programador
>
>
>
> Sensa Control Digital S.A. de C.V.
>
> Dir. Av. Bravo #93 Ote.
>
> Col. Centro.
> Torreón Coah.
>
>
>
> Tel. Directo: (871) 747 01 04
>
> Conmutador: (871) 747 01 01
>
> Tel. Fax: (871) 747 01 90
>
> Correo Electrónico: mpena(at)sensacd(dot)com(dot)mx
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-10-22 21:36:00 Re: how to split coordinates from point
Previous Message Fernando Moreno 2008-10-22 20:59:00 Re: triggers problems whit function