[Pgsql-ayuda] Error en la funcion
Edwin Quijada
listas_quijada@hotmail.com
Tue, 2 Sep 2003 21:28:34 -0400
Tengo un error en la sigte funcion cuando comparo con strings.
Este es el error que consigo no se porque tal vez estoy preguntandoi mal??
:Error: parser: parse error at or near "rep" at character 116
Este es mi codigo:
CREATE FUNCTION testp(int4,char,int4) RETURNS numeric AS '
DECLARE
tipo int;
reg record;
BEGIN
if ($2='rep') then
tipo:=1;
end if;
SELECT INTO reg * FROM t_comisiones a,t_superior b
WHERE a.f_codigo_agente = $1 AND
a.f_codigoramo = tipo AND
b.f_whole = a.f_whole AND
b.f_nivel = $3 ;
--
IF FOUND THEN
RETURN (reg.f_comision/100);
ELSE
RETURN 0;
END IF;
END;'
LANGUAGE 'plpgsql';