0
我要插入從功能表lokasi ...但是,當我把這些功能也有錯誤...請你的答案呼叫功能PostgreSQL的
CREATE OR REPLACE FUNCTION insert_lokasi2
(anip character varying, aeksemplar character varying)
RETURNS boolean AS
$BODY$
DECLARE
eks integer;
tot integer;
nilai boolean;
eks1 integer;
eks2 integer;
tot2 integer;
BEGIN
select sum(CAST(eksemplar AS INT))
INTO eks
from lokasi
where nip = anip;
tot := eks + aeksemplar;
select CAST(eksemplar AS INT)
INTO eks1
from sensus
where nip = anip;
select CAST(eksemplar2 AS INT)
INTO eks2
from sensus
where nip = anip;
tot2 := eks1 + eks2;
IF (tot <> tot2) THEN
nilai := false;
else
nilai := true;
END IF;
RETURN nilai;
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION insert_lokasi2(character varying, character varying) OWNER TO postgres;
select * from insert_lokasi2('10.1010.4703','1');
錯誤:運營商不存在:整數+字符改變
LINE 1: SELECT $1 + $2
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT $1 + $2
CONTEXT: PL/pgSQL function "insert_lokasi2" line 12 at assignment
是的,我froget鑄造aeksemplar :) thx爲您的答案 – Nike 2011-04-01 04:59:27