Function in Postgresql with update returns error when updating 2 columns

0

I'm a beginner in postgresql and I have a question I can not solve. I did a simple function in the database that updates a record:

CREATE OR REPLACE FUNCTION public.teste(
    p_rec_id_transacao character varying,
    p_rec_valorA numeric)
RETURNS boolean AS
$BODY$
BEGIN 

     UPDATE financeiro_recebimentos SET rec_valorA=p_rec_valorA

 WHERE rec_id_transacao = P_rec_id_transacao;
 IF FOUND THEN
   RETURN TRUE;
 ELSE
   RETURN FALSE;
 END IF;    
END
$BODY$
LANGUAGE plpgsql

It works fine, but when I add a new parameter and put it in UPDATE it returns an error when I call the function, the table is correctly defined and worse, when I run the PGadmin3 debug it works:

CREATE OR REPLACE FUNCTION public.teste(
    p_rec_id_transacao character varying,
    p_rec_valorA numeric,
    p_rec_valorB numeric)
  RETURNS boolean AS
$BODY$
BEGIN 

   UPDATE financeiro_recebimentos SET rec_valorA=p_rec_valorA, 
                                      rec_valorB=p_rec_valorB

   WHERE rec_id_transacao = P_rec_id_transacao;
   IF FOUND THEN
      RETURN TRUE;
   ELSE
      RETURN FALSE;
   END IF;    
END
  $BODY$
  LANGUAGE plpgsql

When I call the function "SELECT test ('DJUNU', 1.0.2.0)" returns error:

HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Anyone who has the patience to respond, thank you.

    
asked by anonymous 15.07.2017 / 03:00

1 answer

1

Try to do so:

SELECT teste('DJUNU'::varchar,1.0::numeric,2.0::numeric)

The error you are giving is that sgdb is not finding a function with this name and parameters

    
15.07.2017 / 03:05