我想写一个比较两个图像的函数。该函数编译并且没有警告。
这是功能:
CREATE OR REPLACE FUNCTION compare_images(id1 integer, id2 integer) return integer AS
image1 ORDimage;
image2 ORDimage;
image_sig1 ORDSYS.ORDImageSignature;
image_sig2 ORDSYS.ORDImageSignature;
wartosc INTEGER;
BEGIN
SELECT picture INTO image1 FROM pictures_tab
WHERE id_picture = id1;
SELECT picture INTO image2 FROM pictures_tab
WHERE id_picture = id2;
image_sig1.generateSignature(image1);
image_sig2.generateSignature(image2);
wartosc := ORDSYS.ORDImageSignature.isSimilar(image_sig1,
image_sig2,'color=1.0,texture=0,shape=0,location=0',10);
return wartosc;
END;
当我尝试以下列方式运行该功能时:
select compare_images(33,34) from dual;
我确信论据是正确的。
我收到错误:
Error report:
SQL Error: ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: przy "SAGA.COMPARE_IMAGES", line 12
30625. 00000 - "method dispatch on NULL SELF argument is disallowed"
*Cause: A member method of a type is being invoked with a NULL SELF
argument.
*Action: Change the method invocation to pass in a valid self argument.
答案 0 :(得分:1)
ORDImageSignature在11g中已弃用,并且在文档中没有多少出现。来自10g documentation:
ORDImageSignature对象必须初始化并插入表中或使用临时LOB创建,以成功生成对象的签名。
签名变量需要先从静态init()
方法初始化,然后才能在该实例上调用generateSignature()
方法。
所以你的功能需要做:
image_sig1 := ORDSYS.ORDImageSignature.init();
image_sig1.generateSignature(image1);
image_sig2 := ORDSYS.ORDImageSignature.init();
image_sig2.generateSignature(image2);