[Pgsql-ayuda] Error en la funcion

From: "Edwin Quijada" <listas_quijada(at)hotmail(dot)com>
To: "Pgsql" <pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx>
Subject: [Pgsql-ayuda] Error en la funcion
Date: 2003-09-03 01:28:34
Message-ID: BAY1-DAV26vpolG02G50000647b@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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';

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2003-09-03 02:17:43 Re: [Pgsql-ayuda] Create or replace function con triggers
Previous Message Manuel Sugawara 2003-09-02 23:15:01 Re: [Pgsql-ayuda] Create or replace function con triggers