PL/SQL 中有散列函数吗?

2023-11-02数据库问题
0

本文介绍了PL/SQL 中有散列函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在 PL/SQL 中寻找哈希函数,以获取 varchar 的哈希.我在 Oracle 10 中找到了一个名为 dbms_crypto 的包,其中包含一个函数 dbms_crypto.hash 甚至其他包 dbms_sqlhash.getHash,但是在我调用它们的地方,我收到一条消息,就像它找不到它们一样......

I'm looking for a Hash function in PL/SQL, to get the hash of a varchar. I found a package in Oracle 10 called dbms_crypto with a function dbms_crypto.hash and even other package dbms_sqlhash.getHash, however where I called them, I've got a message like it cannot find them...

有人知道我怎么称呼他们吗??还有其他包吗?

Does somebody know how can I call them?? Is there any other package?

这是我的代码

DECLARE
 l_textToHash VARCHAR2(19) := 'toto123';
 l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_textToHash);
 l_encrypted_raw RAW(2048);
BEGIN
  dbms_output.put_line('CC:  ' || l_ccn_raw);
  l_encrypted_raw := dbms_crypto.hash(l_ccn_raw, 3);
  dbms_output.put_line('SH1: ' || l_encrypted_raw);
END;
/

这是消息

Error starting at line 1 in command:
DECLARE
 l_textToHash VARCHAR2(19) := 'toto123';
 l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_textToHash);
 l_encrypted_raw RAW(2048);
BEGIN
  dbms_output.put_line('CC:  ' || l_ccn_raw);
  l_encrypted_raw := dbms_crypto.hash(l_ccn_raw, 3);
  dbms_output.put_line('SH1: ' || l_encrypted_raw);
END;
Error report:
ORA-06550: line 7, column 22:
PLS-00201: identifier 'DBMS_CRYPTO' must be declared
ORA-06550: line 7, column 3:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:
%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

谢谢!

推荐答案

确保您已向与之连接的用户授予适当的权限.与您的 DBA 联系以添加对 SYS.DBMS_CRYPTO 包的执行权限.

Make sure that you have the appropriate permissions granted to the user that you are connecting with. Talk to your DBA to add the execute permission on the SYS.DBMS_CRYPTO package.

Oracle 提供了一个很好的指南 使用 oracle 数据库处理散列和加密数据.

Oracle provides a nice guide on working with hashed and encrypted data using the oracle database.

如果您使用的是不支持 DBMS_CRYPTO 的旧版本数据库,您也可以尝试 DBMS_OBFUSCATION_TOOLKIT.

If you are on an older version of the database that doesn't support DBMS_CRYPTO, you can also try DBMS_OBFUSCATION_TOOLKIT.

在 Oracle 12c 中,您可以使用函数 STANDARD_HASH.

In Oracle 12c you can use the function STANDARD_HASH.

这篇关于PL/SQL 中有散列函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

创建分层定义的数据集的扁平表/视图
Creating a flattened table/view of a hierarchically-defined set of data(创建分层定义的数据集的扁平表/视图)...
2024-04-16 数据库问题
4

MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?
MySQL: how to do row-level security (like Oracle#39;s Virtual Private Database)?(MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?)...
2024-04-16 数据库问题
6

强制执行具有完整性约束的“子集"关系的最佳方法是什么
What is the best way to enforce a #39;subset#39; relationship with integrity constraints(强制执行具有完整性约束的“子集关系的最佳方法是什么)...
2024-04-16 数据库问题
7

使用 oracle SQL 按分隔符位置拆分字符串
Split String by delimiter position using oracle SQL(使用 oracle SQL 按分隔符位置拆分字符串)...
2024-04-16 数据库问题
46

如何根据列的值展开Oracle查询的结果
How to unfold the results of an Oracle query based on the value of a column(如何根据列的值展开Oracle查询的结果)...
2024-04-16 数据库问题
8