Thread: error in function!!
Hi,
i have a problem with the following sentence:
CREATE OR REPLACE FUNCTION tschema.sp_actualizar_contacto(p_idpers text,
p_nombre text,
p_apellido text,
p_titulo text,
p_fecnac text,
p_codedociv integer,
p_sexo text,
p_codpais integer,
p_pw text,
p_empr text,
p_cargo text,
p_pwempr text,
p_aniv text,
p_prof text,
p_trab text,
p_fecgen text,
p_fecing text,
p_fuente text,
p_codupload integer,
cli_codigo integer ) RETURNS text as '
p_nombre text,
p_apellido text,
p_titulo text,
p_fecnac text,
p_codedociv integer,
p_sexo text,
p_codpais integer,
p_pw text,
p_empr text,
p_cargo text,
p_pwempr text,
p_aniv text,
p_prof text,
p_trab text,
p_fecgen text,
p_fecing text,
p_fuente text,
p_codupload integer,
cli_codigo integer ) RETURNS text as '
DECLARE
c_codigo integer;
c_sinc varchar;
c_idpers ALIAS for $1;
c_nombre ALIAS for $2;
c_apellido ALIAS for $3;
c_titulo ALIAS for $4;
c_fecnac ALIAS for $5;
c_codedociv ALIAS for $6;
c_sexo ALIAS for $7;
c_codpais ALIAS for $8;
c_pw ALIAS for $9;
c_empr ALIAS for $10;
c_cargo ALIAS for $11;
c_pwempr ALIAS for $12;
c_aniv ALIAS for $13;
c_prof ALIAS for $14;
c_trab ALIAS for $15;
c_fecgen ALIAS for $16;
c_fecing ALIAS for $17;
c_fuente ALIAS for $18;
c_codupload ALIAS for $19;
cli_Codigo ALIAS for $20;
BEGIN
select nextval(''seq_tbu_contacto_cont_codigo'') into c_codigo;
c_codigo integer;
c_sinc varchar;
c_idpers ALIAS for $1;
c_nombre ALIAS for $2;
c_apellido ALIAS for $3;
c_titulo ALIAS for $4;
c_fecnac ALIAS for $5;
c_codedociv ALIAS for $6;
c_sexo ALIAS for $7;
c_codpais ALIAS for $8;
c_pw ALIAS for $9;
c_empr ALIAS for $10;
c_cargo ALIAS for $11;
c_pwempr ALIAS for $12;
c_aniv ALIAS for $13;
c_prof ALIAS for $14;
c_trab ALIAS for $15;
c_fecgen ALIAS for $16;
c_fecing ALIAS for $17;
c_fuente ALIAS for $18;
c_codupload ALIAS for $19;
cli_Codigo ALIAS for $20;
BEGIN
select nextval(''seq_tbu_contacto_cont_codigo'') into c_codigo;
Insert into tbu_contacto (cont_codigo, cont_idpers,cont_nombre,cont_apellido,cont_titulo,cont_fecnac,cont_codedociv,cont_sexo,cont_codpais,cont_pw,cont_empr,cont_cargo,cont_pwempr,cont_aniv,cont_prof,cont_trab,cont_fecgen,cont_fecing,cont_fuente,cont_sinc,cont_codupload) values (c_codigo,c_idpers,c_nombre,c_apellido,c_titulo,to_timestamp(c_fecnac,''YYYY-mm-dd HH:MM:SS''),c_codedociv,c_sexo,1,c_pw,c_empr,c_cargo,c_pwempr,c_aniv,c_prof,c_trab,to_timestamp(c_fecgen,''YYYY-mm-dd HH:MM:SS''),to_timestamp(CURRENT_TIMESTAMP,''YYYY-mm-dd HH:MM:SS'') ,c_fuente,''S'',c_codupload);
return ''OK:''||c_codigo;
END;
' LANGUAGE 'plpgsql'
' LANGUAGE 'plpgsql'
this is the error in pgadmin III on windows (postgresql 8.0):
ERROR: function tschema.sp_actualizar_contacto(integer, "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", integer, "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", integer, integer) does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
I need to know if the "insert sentence" was sucesfull, how do i do?
help me with this please,
thanks!!
On Jan 31, 2005, at 1:59 PM, Ing. Jhon Carrillo wrote: > > ERROR: function tschema.sp_actualizar_contacto(integer, "unknown", > "unknown", "unknown", "unknown", "unknown", "unknown", integer, > "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", > "unknown", "unknown", "unknown", "unknown", "unknown", integer, > integer) does not exist > HINT: No function matches the given name and argument types. You may > need to add explicit type casts. > > > I need to know if the "insert sentence" was sucesfull, how do i do? > This message is telling you that your function call using tschema.sp_actualizar_contacto was not correct. You must have all parameters in the function call and they must all be the correct type. So the message above says the first parameter passed was an integer, but your function expects the first parameter to be text. Note that you can remove all of the ALIAS declarations and use parameter name directly. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL