Error in Accessing DBMS_Crypto package Encrypt and Decrypt Function Getting Error "PLS-00201: identifier 'SYS.DBMS_CRYPTO' must be declared"
select sys.DBMS_CRYPTO.encrypt(UTL_RAW.CAST_TO_RAW ('ABCDEFGH12345'), 4356 /* = dbms_crypto.DES_CBC_PKCS5 */, 'A1A2A3A4A5A6CAFE')
from dual;
Rajkiran SwainPosted Apr 4, 2023, 12:24 PM
To resolve this error, you can take the following steps:
Check if the DBMS_CRYPTO package is installed in the schema where you are executing the SQL statement. You can do this by connecting to the database as a user with DBA privileges and running the following SQL statement:
SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = 'DBMS_CRYPTO';
If the package exists, you should see a row returned with OBJECT_TYPE = 'PACKAGE'.
If the package is not installed, you can install it by executing the following SQL script as a user with DBA privileges:
@$ORACLE_HOME/rdbms/admin/dbmscsql.sql
This script creates the package specification and body for the DBMS_CRYPTO package in the SYS schema.
If the package is installed, ensure that the user executing the SQL statement has been granted EXECUTE privilege on the DBMS_CRYPTO package. You can grant this privilege by executing the following SQL statement as a user with DBA privileges:
GRANT EXECUTE ON SYS.DBMS_CRYPTO TO;
Replace with the name of the user that needs access to the package.
Once you have completed these steps, you should be able to execute the SQL statement to encrypt your data using the DBMS_CRYPTO package without encountering the PLS-00201 error.