Oracle 中的哈希字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9929290/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:41:39  来源:igfitidea点击:

Hashing string in Oracle

oraclehash

提问by BRabbit27

I know there's a function to obtain the hash value from a varchar in Oracle, but when I run the query to see the returned value it sends the following message.

我知道有一个函数可以从 Oracle 中的 varchar 获取哈希值,但是当我运行查询以查看返回值时,它会发送以下消息。

ORA-00904: : identificador no válido
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
Error en la línea: 70, columna: 7

What I'm doing is the following:

我正在做的是以下内容:

select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;

It should return the SHA-1 of the string.

它应该返回字符串的 SHA-1。

回答by Justin Cave

That works for me

这对我行得通

SQL> select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;

DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('FOO'),3)
--------------------------------------------------------------------------------
201A6B3053CC1422D2C3670B62616221D2290929

Are you sure that the user that is running this has been granted EXECUTEaccess on both the UTL_RAWand the DBMS_CRYPTOpackages? If line 70 of your code is this SELECTstatement, I'd wager that column 7 is where the DBMS_CRYPTOcall starts and that you don't have access to the DBMS_CRYPTOpackage.

您确定运行此程序的用户已被授予EXECUTEUTL_RAWDBMS_CRYPTO包的访问权限吗?如果您的代码的第 70 行是这个SELECT语句,我敢打赌第 7 列是DBMS_CRYPTO调用开始的地方,并且您无权访问该DBMS_CRYPTO包。