Calculates the SHA-1 hash value of expr that is of the STRING or BINARY type and returns the SHA-1 hash value in hexadecimal string format.
Syntax
string sha(string|binary <expr>)
Parameters
expr: required. A value of the STRING or BINARY type.
Return value
A value of the STRING type is returned. If the input parameter is set to null, null is returned.
Examples
Example 1: Calculate the SHA hash value of string
ABC
. Sample statement:-- The return value is 3c01bdbb26f358bab27f267924aa2c9a03fcfdb8. select sha('ABC');
Example 2: An input parameter is set to null. Sample statement:
-- The return value is null. select sha(null);
Related functions
For more information, see Other functions.