Antonio Antonio - 29 days ago 7
SQL Question

ERROR executing Function postgresql

I'm getting mad trying to figure out what I'm doing wrong.

I have a function that starts with:

CREATE OR REPLACE FUNCTION public.insert_contato_site(
_nome character varying,
_sobrenome character varying,
_sexo character varying,
_cpf character varying,
_nascimento date,
_end_logradouro character varying,
_end_numero character varying,
_end_complemento character varying,
_end_bairro character varying,
_end_cidade character varying,
_end_estado character varying,
_end_cep character varying,
_email character varying,
_tel_fixo character varying,
_tel_celular1 character varying,
_metodo_pgto character varying,
_dia_pgto integer, _valor numeric,
_debito_agencia character varying,
_debito_conta character varying,
_cc_num character varying,
_cc_cvv character varying,
_cc_vencimento character varying,
_cc_nome character varying)
RETURNS integer
LANGUAGE plpgsql
AS $function$



When I try to execute it, as the example:

SELECT * FROM insert_contatos_site (
'John'::VARCHAR,
'Smith'::VARCHAR,
'N'::VARCHAR,
'11111'::VARCHAR,
'1900-01-01'::DATE,
'Av Nossa Sra de Copacabana'::VARCHAR,
'419'::VARCHAR,
'1'::VARCHAR,
NULL::VARCHAR,
'RIO DE JANEIRO'::VARCHAR,
'RJ'::VARCHAR,
'22710-790'::VARCHAR,
NULL::VARCHAR,
'21 1234-5678'::VARCHAR,
NULL::VARCHAR,
'BOLETO'::VARCHAR,
15,
200.0,
NULL ::VARCHAR,
NULL::VARCHAR,
NULL::VARCHAR,
NULL::VARCHAR,
NULL::VARCHAR,
NULL::VARCHAR)


It gives me this error:

[42883] ERROR: function insert_contatos_site(character varying, character varying, character varying, character varying, date, character varying, character varying, character varying, character varying, character varying, character varying, character varying, character varying, character varying, character varying, character varying, integer, numeric, character varying, character varying, character varying, character varying, character varying, character varying) does not exist

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

Position: 15




As you can see, all arguments are explcit type cast, but still not working. Ideas?

Answer

You misspelled your function's name it's insert_contato_site without the s

Comments