Oracle DBMS_SQLHASH
Version 12.1.0.1

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.
Purpose Apply a supported cryptographic hash function to a SQL statement. This function can not be used to hash a string that is not a valid SQL statement.
AUTHID CURRENT_USER
Constants (uses DBMS_CRYPTO constants also listed here)
Name Data Type Value
HASH_MD4 (128 bit hash) BINARY_INTEGER 1
HASH_MD5 (128 bit hash) BINARY_INTEGER 2
HASH_SH1 (160 bit hash) BINARY_INTEGER 3
HASH_SH256 BINARY_INTEGER 4
HASH_SH384 BINARY_INTEGER 5
HASH_SH512 BINARY_INTEGER 6
Dependencies
DBMS_CRYPTO DBMS_SQL UTL_RAW
DBMS_LOB    
Documented No
First Available 12.1.0
Security Model Owned by SYS with no privileges granted
Source {ORACLE_HOME}/rdbms/admin/dbmsobtk.sql
 
GETHASH
Provides an interface to generate the hash value of the result set returned by a SQL query dbms_sqlhash.gethash(
sqltext     IN VARCHAR2,                 -- input sql statement
digest_type IN BINARY_INTEGER,           -- digest algorithm type
chunk_size  IN NUMBER DEFAULT 134217728) -- 128M
RETURN RAW;
set serveroutput on

DECLARE
 sqlstr  VARCHAR2(4000):='SELECT object_name FROM all_objects WHERE rownum = 1';
 digtype PLS_INTEGER := 3;
 RetVal  RAW(2000);
BEGIN
  SELECT dbms_sqlhash.gethash(sqlstr, dbms_crypto.hash_sh1)
  INTO RetVal
  FROM dual;

  dbms_output.put_line(RetVal);
END;
/

Related Topics
DBMS_CRYPTO
ORA_HASH
Packages
Security

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved