Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/07/2010, 11:17
Dantalian
 
Fecha de Ingreso: abril-2010
Mensajes: 49
Antigüedad: 14 años
Puntos: 0
Respuesta: Sentencias If y Case

Código HTML:
DECLARE
	registros idactivo;
	a ALIAS FOR $2;
BEGIN
	CASE a 
	WHEN 'primero' THEN
		FOR registros IN EXECUTE 'select d.idtransferencia from transferenciadetalle d, 
		transferencia t where d.idactivo=' ||  quote_literal(idactivo) || ' and d.estado=' || quote_literal('T') || ' 
		and d.idtransferencia=t.nro_doc and t.estado=' ||  quote_literal('F') || ' order by d.idtransferencia desc limit 1' loop
		end loop;
	WHEN 'segundo' THEN
		FOR registros IN EXECUTE 'select id_responsable_destino,id_ubicacion_destino from transferencia 
		where nro_doc=' ||  quote_literal(transferencia) loop
		end loop;
	END
return next registros;
END;
Me genera error en WHEN