CREATE OR REPLACE FUNCTION public.udf_insertcontact(
_pid integer,
_firstname character varying(30),
_lastname character varying(30),
_emailaddress character varying(100),
_company character varying(50),
_category character varying,
_gender character varying,
_dob timestamp,
_modeslack boolean,
_modewhatsapp boolean,
_modeemail boolean,
_modephone boolean,
_contactimage character varying)
RETURNS integer
LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
INSERT INTO public.tblcontacts(
professionid, firstname, lastname, emailaddress, company, category, gender, dob, modeslack, modewhatsapp, modeemail, modephone, contactimage)
VALUES (
_pid, _firstname, _lastname, _emailaddress, _company, _category, _gender, _dob, _modeslack, _modewhatsapp, _modeemail, _modephone, _contactimage);
IF FOUND THEN -- INSERTED SUCCESSFULLY
RETURN 1;
ELSE RETURN 0; -- INSERTED FAIL
END IF;
END
$BODY$;
SELECT public.udf_insertcontact(2,'first','last','email@e.com','company','Client','Female',current_timestamp,false,true,false,true,'');
错误:函数public.udf_insertcontact(整数,未知,未知,未知,未知,带时区的时间戳,布尔,布尔,布尔,布尔,未知)不存在
1条答案
按热度按时间wqsoz72f1#
您的函数没有问题,您需要对参数
current_timestamp::timestamp
进行类型转换这将工作:
Demo here