首页 文章

ORA-06553使用Blob在Oracle中使用java函数的错误参数

提问于
浏览
0

我正在尝试在Oracle 11g中实现一个函数,该函数调用java类来解密Blob图像信息 .

一切似乎都有效,但我得到一个ORA-06553 PLS-306“错误数量或类型的参数”

该函数采用blob并返回blob,因此我看不到错误的来源 .

PL / SQL功能:

create or replace
function decrypt_image return blob as
language JAVA name 'Imageutil.decryptBlobImage (java.sqlBlob) return java.sqlBlob';

Java功能:

public class Imageutil
public static java.sql.Blob decryptBlobImage (java.sql.Blob img) throws Exception {
    try {
        int len = (int)img.length();
        byte[] imagearray = img.getBytes(1, len);
        byte[] decrypted = Encryptor.decryptBinary(imagearray);
        Blob retval = new SerialBlob(decrypted);
        return retval;
    } catch (SQLException ex) {
        ex.printStackTrace();
        throw new Exception("Error handling blob",ex);
    }
}
}

数据在表格中:

temp_image(id number, image blob, decrypted blob);

我在尝试着

update temp_image set decrypted = decrypt_image(image);

当我收到错误 . 每次都会生成一个Oracle trc文件,但似乎没有错误:

========= Dump for error ORA 1110 (no incident) ========
----- DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (Async) -----

(然后对数据库进行完整性检查) .

该函数有效,原始数据是长原始的,我可以采取十六进制数据转储并解密它 . 测试表由原始长原始数据上的to_lob()函数加载 .

1 回答

  • 0

    您似乎在PL / SQL声明中有 java.sqlBlob 而不是 java.sql.Blob ;但是你也没有为你的函数提供一个参数声明:

    create or replace
    function decrypt_image (original_blob blob) return blob as
    language JAVA name 'Imageutil.decryptBlobImage (java.sql.Blob) return java.sql.Blob';
    

    你的版本PL / SQL函数没有参数,所以当你把它称为 decrypt_image(image) 时,你传递的参数数量错误 - 它只是期望没有参数 .

相关问题