Ver Mensaje Individual
  #13 (permalink)  
Antiguo 29/05/2009, 13:32
r0xdrig0
 
Fecha de Ingreso: diciembre-2007
Mensajes: 385
Antigüedad: 16 años, 4 meses
Puntos: 0
Respuesta: como hacer este trigger????

Hola denuevo amigos, aun sigo aproblemado con el trigger de visita, me manda el siguiente error al eliminar a un niño; el error es:

---------------------------------------------------------------------------------------------
ERROR: record "new" is not assigned yet
DETAIL: the tuple structure of a not-yet-assigned record is indeterminate
CONTEXT: PL/pgSQL function "eliminar_visitante" line 8 at SQL statement
---------------------------------------------------------------------------------------------
no se pq me manda este error he provado con new y con old pero me sigue mandando el mismo error, el trigger en cuestion es el siguiente:

Código:
CREATE OR REPLACE FUNCTION eliminar_visitante() returns TRIGGER AS
  
      $$
  
      declare
   
      nino record;
  
      Begin
  
      SELECT INTO nino count(rut_visitante) AS numvisitas FROM visita WHERE rut_visitante=old.rut_visitante;
   
      IF nino.numvisitas = 0 then  
  
        DELETE FROM visitante WHERE old.rut_visitante=rut_visitante;
  
      end IF;
 
      RETURN old;
  
      End;
 
      $$
 
      LANGUAGE 'plpgsql';
 
       
  
      CREATE TRIGGER borrar_visitante before
  
      DELETE ON nino
 
      FOR each row execute procedure eliminar_visitante();
en q estoy fallando amigos???.... porfavor ayuda!!!!!!! esto me tiene urgidicimo!!!! pls ayuda!! de antemano gracias.... bye