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

Por ejemplo esta función pr_translvl10(idactivo,condicion)

Código HTML:
DECLARE
	registros idactivo;
	a ALIAS FOR $2;
BEGIN
	IF a='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
	ELSE IF a='segundo' THEN
		FOR registros IN EXECUTE 'select id_responsable_destino,id_ubicacion_destino from transferencia 
		where nro_doc=' ||  quote_literal(transferencia) loop
	END IF;
return next registros;
end loop;
return;
END;
Y tampoco pueda crear esta función, el error que se me genera es 'sintax error at or near "ELSE" at character 495'