| From: | Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
|---|---|
| To: | Gutiérrez Cuberos Tania Milena <tgutierrez(at)unipamplona(dot)edu(dot)co> |
| Cc: | <pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx> |
| Subject: | Re: [Pgsql-ayuda] triggers |
| Date: | 2003-12-23 20:21:17 |
| Message-ID: | 200312231721.17289.martin@bugs.unl.edu.ar |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
El Mar 23 Dic 2003 16:56, Gutiérrez Cuberos Tania Milena escribió:
> Hola Amigos de postgres
>
> Necesito pasar un trigger hecho en oracle a postgres:
>
>
>
> CREATE OR REPLACE TRIGGER TR_I_AUD_RECIBIDO
> AFTER INSERT ON RECIBIDO
> FOR EACH ROW
> BEGIN
> INSERT INTO AUD_RECIBIDO (
> RECI_ID, RECI_ASUNTO, RECI_ESTADO, RECI_FECHA, RECI_NOMBREMENSAJE,
> RECI_SUBPATH, RECI_TAMANO, RECI_REGISTRADOPOR, RECI_FECHACAMBIO,ADRE_ID,
> CUEN_ID, CUEN_IDRECIBIDO, RECI_OPERACION) VALUES (
> :new.RECI_ID, :new.RECI_ASUNTO, :new.RECI_ESTADO, :new.RECI_FECHA,
> :new.RECI_NOMBREMENSAJE, :new.RECI_SUBPATH, :new.RECI_TAMANO,
> :new.RECI_REGISTRADOPOR, :new.RECI_FECHACAMBIO, :new.ADRE_ID,
> :new.CUEN_ID, :new.CUEN_IDRECIBIDO, 'I');
> END;
>
> Existe dos tablas: RECIBO Y LA AUD_RECIBO
Hacelo en dos partes.
Crea una funcion que devuelva un tipo de dato TRIGGER y no tenga argumentos.
Dicha funcion deberia hacer lo que se realiza entre el BEGIN y el END.
Cuando creas el trigger con las misma reglas, le decis que ejecute dicha
funcion.
Mira el manual de PostgreSQL:
http://www.postgresql.org/docs/current/interactive/triggers.html
http://www.postgresql.org/docs/current/interactive/xplang.html
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Roberto Osorio González | 2003-12-23 20:23:55 | Re: [Pgsql-ayuda] Compilación de Postgres 7.4 |
| Previous Message | Gutirrez Cuberos Tania Milena | 2003-12-23 19:56:47 | [Pgsql-ayuda] triggers |