插入前触发处理ORDImage

时间:2015-12-22 22:55:51

标签: oracle plsql triggers oracle-apex

我想在将上传的图片插入数据库之前将其缩小到正确的大小。

在Apex中,我创建了一个简单的表单,允许用户上传文件,并设置了以下触发器。

create or replace TRIGGER new_post
  BEFORE INSERT
  ON posts

FOR EACH ROW

BEGIN
  --l_image := ORDSYS.ORDImage.Init();
  --SELECT image INTO l_image FROM posts WHERE posts.post_id = :old.post_id FOR UPDATE;
   ORDSYS.ORDImage.process(:new.image, 'maxscale=200 200');

  :new.user_id := v(':APP_USER');
END;

编译正常,但是当我尝试上传图像时,会产生以下错误:

1 error has occurred

ORA-29400: data cartridge error
IMG-00730: unable to process empty image
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 75
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 65
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 29
ORA-06512: at "ORDSYS.ORDIMG_PKG", line 121
ORA-06512: at "ORDSYS.ORDIMAGE", line 1366
ORA-06512: at "MATTHEWLAWS.NEW_POST", line 4
ORA-04088: error during execution of trigger 'MATTHEWLAWS.NEW_POST'

我哪里错了?

我还想创建另一个缩略图放在同一个表格中。

1 个答案:

答案 0 :(得分:0)

有关详细信息,请参阅以下链接,但触发器中基本上不支持blob。所以你试图处理数据库看到的空字段。

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:487421613802