我试图在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()函数加载的。
发布于 2015-03-06 23:59:24
在PL/SQL声明中,您似乎使用了java.sqlBlob而不是java.sql.Blob;但是您也没有在该declaraion中为您的函数提供参数:
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)时,您传递的参数数量是错误的--它只期望传递一个参数。
https://stackoverflow.com/questions/28909622
复制相似问题