The string to be decrypted. Binary values can also be passed to this function. This parameter is case sensitive, even
in case-insensitive databases.
The encryption key (string) required to decrypt the string-expression. This must be the same encryption key that was used to encrypt the string-expression to obtain the original value that was encrypted. This parameter is case sensitive, even in case-insensitive databases.
For strongly encrypted databases, be sure to store a copy of the key in a safe location. If you lose the encryption key there
is no way to access the data, even with the assistance of technical support. The database must be discarded and you must create
a new database.
This optional parameter specifies the algorithm originally used to encrypt the string-expression.
You can use the DECRYPT function to decrypt a string-expression that was encrypted with the ENCRYPT function. This function returns a LONG BINARY value with the same number of bytes as
the input string.
To successfully decrypt a string-expression, you must use the same encryption key that was used to encrypt the data. If you specify an incorrect encryption key, an error
is generated. A lost key will result in inaccessible data, from which there is no recovery.
The following example decrypts a user's password from the user_info table. The CAST function is used to convert the password
back to a CHAR data type because the DECRYPT function converts values to the LONG BINARY data type, which is unreadable.
SELECT CAST( DECRYPT( user_pwd, '8U3dkA' ) AS CHAR(100) ) FROM user_info;