我做了一个简单的加密 - 解密程序
CREATE OR REPLACE PROCEDURE VIEW_DiemThi_DTB (t_mssv IN VARCHAR2, t_key IN VARCHAR2)
AS
raw_input RAW(128);
raw_key RAW(128);
encrypted_raw RAW(2048);
decrypted_raw RAW(2048);
decrypted_string VARCHAR2(2048);
BEGIN
raw_input := UTL_RAW.CAST_TO_RAW(CONVERT(t_mssv, 'AL32UTF8', 'US7ASCII'));
raw_key := UTL_RAW.CAST_TO_RAW(CONVERT(t_key, 'AL32UTF8', 'US7ASCII'));
encrypted_raw := dbms_crypto.Encrypt(
src => raw_input,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => raw_key
);
decrypted_raw := dbms_crypto.Decrypt(
src => encrypted_raw,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => raw_key
);
DBMS_OUTPUT.PUT_LINE(decrypted_raw);
END;
我通过删除解密函数并调用来测试加密函数:
EXECUTE VIEW_DiemThi_DTB('18127057', 'a');
而且效果很好。但是在添加DECRYPT函数并使用相同的参数执行 proc 之后,我得到了错误:
Error starting at line : 110 in command -
BEGIN VIEW_DiemThi_DTB('18127057', 'a'); END;
Error report -
ORA-28817: PL/SQL function returned an error.
ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
ORA-06512: at "SYS.DBMS_CRYPTO", line 44
ORA-06512: at "AN.VIEW_DIEMTHI_DTB", line 23
ORA-06512: at line 1
28817. 00000 - "PL/SQL function returned an error."
*Cause: A PL/SQL function returned an error unexpectedly.
*Action: This is an internal error. Enable tracing to find more
information. Contact Oracle customer support if needed.
*Document: NO
我检查了我的语法,在网上搜索了很多次,但仍然找不到问题。有人可以帮我解决这个问题吗?谢谢你。