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)
2 つの画像を比較して、まだ存在しない場合にのみ、BLOB 画像を PHOTOS テーブルに移動したいと考えています。ORDImageSignature メソッドは Oracle 11g では非推奨になっているため、 SQL/MM Still Imageメソッドを使用する必要があります。
コードは次のとおりです。
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 )。
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;
ありがとうございました !