【发布时间】:2013-10-24 13:11:18
【问题描述】:
我正在使用 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", ligne 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;
谢谢!
【问题讨论】:
标签: oracle plsql blob oracle11gr2