Oracle:如何调用重载过程? [英] Oracle: How to call an overloaded procedure?

查看:293
本文介绍了Oracle:如何调用重载过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确调用 DBMS_OBFUSCATION_TOOLKIT.DESEncrypt ? (如果可能,不使用PL / SQL)

How to properly call DBMS_OBFUSCATION_TOOLKIT.DESEncrypt? (without using PL/SQL if possible)

select DBMS_OBFUSCATION_TOOLKIT.DESEncrypt('x','y') from dual;

因为DESEncrypt重载不起作用:

doesn't work because DESEncrypt is overloaded:

ORA-06553: PLS-307: Too many declarations of "DESENCRYPT" match this call
06553. 00000 -  "PLS-%s: %s"
*Cause:    
*Action:

有没有办法选择一个DESENCRYPT (可能是VARCHAR2变体)以避免这个错误?

Is there a way to choose one implementation of DESENCRYPT (possibly the VARCHAR2 variant) to avoid this error?

推荐答案

这里你去,只是让它知道使用哪个重载param name!

here you go, just let it know which overload to use by supplying the param names!

select DBMS_OBFUSCATION_TOOLKIT.DesEncrypt(INPUT_STRING=>'11112abc',KEY_STRING=>'4578ccde') 
from dual ;

返回


M5 w5Z

M5��w5Z

注意,您的密钥至少需要8个字节:

note, your key needs to be at least 8 bytes:


ORA-28234:key length too short
ORA-06512:at
SYS.DBMS_OBFUSCATION_TOOLKIT_FFI,
line 21 ORA-06512:在
SYS.DBMS_OBFUSCATION_TOOLKIT,行
126
28234. 00000 - 密钥长度太短
*原因:指定的密钥对算法来说太短。 DES
需要至少8个字节的密钥。三重DES需要在双键模式下至少为16个字节的
密钥和三键
模式中的24个字节。
*动作:指定一个较长的键。

ORA-28234: key length too short ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT_FFI", line 21 ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT", line 126 28234. 00000 - "key length too short" *Cause: The key specified is too short for the algorithm. DES requires a key of at least 8 bytes. Triple DES requires a key of least 16 bytes in two-key mode and 24 bytes in three-key mode. *Action: Specify a longer key.






它具有包装功能(如tony所示)


You may always try it with a wrapper function (as tony suggested)

create or replace
function DesEncrypt(pinputString IN VARCHAR2 , pKeyString in VARCHAR2) RETURN varchar2
IS
BEGIN
return DBMS_OBFUSCATION_TOOLKIT.DesEncrypt(INPUT_STRING=>INPUTSTRING,KEY_STRING=>KEYSTRING);
END DesEncrypt;
/
select DesEncrypt('11112abc' , '4578ccde') from dual ;






由于你在10g,你可能想使用DBMS_CRYPTO包
http ://www.stanford.edu/dept/itss/docs/oracle/10g/network.101/b10773/apdvncrp.htm

这篇关于Oracle:如何调用重载过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆