This error occurs when DBMS_CRYPTO.HASH_SH256
is not recognized in Oracle 11g.
✅ Step 1: Verify DBMS_CRYPTO
Package Exists
Run the following query to check if DBMS_CRYPTO
is installed:
🔹 If no rows are returned, the package might be missing or invalid.
✅ Step 2: Grant Execution Privilege
Log in as SYSDBA
and grant the required privilege:
🔹 Replace your_username
with the actual Oracle user.
✅ Step 3: Check Supported Hashing Algorithms in Oracle 11g
Oracle 11g does not support HASH_SH256
. Instead, use HASH_SH1
(SHA-1) or HASH_MD5
(MD5).
Run this to verify available hashing functions:
🔹 Oracle 11g supports only HASH_MD5
, HASH_SH1
, and HASH_SH256
(in 11.2+).
✅ Step 4: Use a Supported Hash Function
If HASH_SH256
is missing, use HASH_SH1
(SHA-1) instead:
🔹 This will return a SHA-1 hash.
✅ Step 5: Upgrade to Oracle 12c+ (If Needed)
If you must use SHA-256, you need Oracle 12c or later. Oracle 11g does not support HASH_SH256
by default.
🔹 Summary: Fixing the Error
Issue | Solution |
---|---|
PLS-00302: component 'HASH_SH256' must be declared | Use HASH_SH1 or HASH_MD5 instead. |
ORA-00904: invalid identifier 'DBMS_CRYPTO.HASH_SH256' | Check if DBMS_CRYPTO exists with SELECT * FROM all_objects WHERE object_name = 'DBMS_CRYPTO'; |
ORA-06550: Identifier 'DBMS_CRYPTO' must be declared | Run GRANT EXECUTE ON DBMS_CRYPTO TO your_username; |
Need SHA-256 in Oracle 11g?
Since Oracle 11g doesn’t support HASH_SH256
, you can implement SHA-256 manually using Java Stored Procedures or external libraries.