ORA-06553 带有 Blob 的 Oracle 中 java 函数的错误参数
ORA-06553 wrong arguments with java function in Oracle with Blob
我正在尝试在 Oracle 11g 中实现一个函数,该函数调用 java class 来解密 Blob 图像信息。
一切似乎都有效,但我得到一个 ORA-06553 PLS-306 "wrong number or types of arguments"
函数接受一个 blob 和 returns 一个 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);
}
}
}
数据在 table:
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) -----
(然后对数据库进行完整性检查)。
函数有效,原始数据是 long raw,我可以对数据进行十六进制转储并解密。测试 table 由 to_lob() 函数在原始长原始数据上加载。
您似乎在 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)
时,你 是 传递了错误的数量arguments - 它期待 none 但你传递了一个。
我正在尝试在 Oracle 11g 中实现一个函数,该函数调用 java class 来解密 Blob 图像信息。
一切似乎都有效,但我得到一个 ORA-06553 PLS-306 "wrong number or types of arguments"
函数接受一个 blob 和 returns 一个 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);
}
}
}
数据在 table:
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) -----
(然后对数据库进行完整性检查)。
函数有效,原始数据是 long raw,我可以对数据进行十六进制转储并解密。测试 table 由 to_lob() 函数在原始长原始数据上加载。
您似乎在 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)
时,你 是 传递了错误的数量arguments - 它期待 none 但你传递了一个。