我正在使用Oracle 11g r2。
我有一个将图像存储为ORDImage的表:
PHOTOS (phot_id integer
, phot_filename varchar2(256)
, phot_source ordsys.ordimage)
另一个临时表将用户上传的图像存储为BLOB。
INSERT_TEMP (itemp_id integer, itemp_source blob)
我只想通过比较两个图像将 BLOB 图像移动到 PHOTOS 表中,前提是它不存在。我需要使用SQL/MM Still Image方法,因为 ORDImageSignature 方法在 Oracle 11g 中已弃用。
这是代码:
declare
[...]
begin
[...]
-- get the blob from the temporary table (in_id passed as parameter)
select itemp_source into l_img_blob from insert_temp where itemp_id = in_id;
-- build the stillimage object from the blob
l_img_obj := new si_stillimage(l_img_blob);
-- get image features and build the featureList object
l_avgcolor := new si_averagecolor(l_img_obj);
l_colorhist := new si_colorhistogram(l_img_obj);
l_poscolor := new si_positionalcolor(l_img_obj);
l_texture := new si_texture(l_img_obj);
l_featurelist := new SI_FeatureList(l_avgcolor, 1, l_colorhist, 1, l_poscolor, 1, l_texture, 1);
-- check if a similar image already exists
select count(*) into l_exist from photos p where SI_ScoreByFtrList(l_featurelist, SI_MkStillImage1(p.phot_source.source.localdata)) = 0;
if (l_exist > 0) then
out_message := app_util.get_translated_message('ERR_SIMILAR_PHOTO_ALREADY_EXISTS');
else
/* here the blob is inserted into the PHOTOS table as ORDImage successfully */
out_message := app_util.get_translated_message('SUC_PHOTO_INSERTED');
end if;
end;
如果我省略比较,图像将作为 ORDImage 成功插入,否则会引发异常(sqlcode: 1, sqlerrm: User-defined Exception),使用 DBMS_UTILITY.FORMAT_ERROR_BACKTRACE 它告诉我以下信息:
ORA-06512:à“ORDSYS.SI_STILLIMAGE”,第 27
行 ORA-06512:à“ORDSYS.SI_MKSTILLIMAGE1”,第 6
行 ORA-06512:à“SURV.APP_CORE”,第 212 行
第 212 行是检查类似图像是否已经存在的行:
select count(*) into l_exist
from photos p
where SI_ScoreByFtrList(l_featurelist, SI_MkStillImage1(p.phot_source.source.localdata)) = 0;
似乎问题在于它不接受p.phot_source.source.localdata
作为参数。您对我如何解决这个问题有任何想法吗?
我也试过:
select count(*) into l_exist
from photos p
where l_featurelist.si_score(new si_stillimage1(p.phot_source.source.localdata)) = 0;
谢谢 !