Postgres函数在执行时给出错误

时间:2019-03-19 12:24:55

标签: postgresql

我试图在Postgres中执行以下功能

CREATE OR REPLACE FUNCTION public.spinsert(
p_rno integer,
p_rdc character varying,
p_pid integer,
p_cid integer,
p_ctid integer,
p_obn character varying,
p_dep integer,
p_no character varying,
p_crv integer,
p_env integer,
p_tid character varying,
p_cby character varying,
p_ds character varying,
p_rcs integer)
RETURNS void
LANGUAGE 'plpgsql'
COST 100
VOLATILE 
AS $BODY$
DECLARE v_redlineid int;
v_objectid int;
BEGIN
    START TRANSACTION;
    IF EXISTS (SELECT  "RedlineNumber" from public."Redline"  where RedlineNumber=p_rno LIMIT 1)
            Then
                select  "RedlineId" into v_redlineid from public."Redline" where RedlineNumber=p_rno LIMIT 1;
            else
                insert into Redline(RedlineNumber,ParentRedlineId,rdc,CreatedDate,CreatedBy)
                Select p_rno,p_pid,p_rdc,now(),p_cby
                RETURNING Redline into  v_redlineid;
            end if;
        insert into Objects(CategoryId,Name) 
        Select p_cid,p_obn
        RETURNING Redline into v_objectid;

        insert into ObjectImplementation(RedlineId,CodeReviewStatusId,ChangeTypeId,Instructions,ObjectId,Notes,
        DeploymentStatus,EnvironmentId,TechReqId)
        Select v_redlineid,p_crv,p_ctid,p_dep,v_objectid,p_no,p_ds,p_Env,p_tid;

        insert into ObjectImplementationHistory(ReleaseCodeStatusTypeId,CreateDatetime,EnvironmentId,ObjectId,RedlineId)
        Select p_rcs,now(),p_Env,v_objectid,v_redlineid;
        COMMIT;
        EXCEPTION
            WHEN OTHERS THEN
            ROLLBACK;
            END;
END;
$BODY$;

执行功能:

SELECT public."spInsert" (777777,'77777 : XXXX',
                          '',1,1,'XX',1,'',1,1,'','XYXZ',1,1);

执行后出错

ERROR:  function public.spinsertreleasesheet1(integer, unknown, unknown, integer, integer, unknown, integer, unknown, integer, integer, unknown, unknown, integer, integer) does not exist
LINE 1: SELECT public.spinsertreleasesheet1 (168159,'168159 : Test S...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 8

有人可以解决吗?

1 个答案:

答案 0 :(得分:1)

您提供的第三个参数是''(空字符串),但是第三个参数的类型为integer

可以预期PostgreSQL的type resolution无法解决此问题。