ASCII
ASCII(str)
Section titled “ASCII(str)”- str: The string from which the ASCII value for the leftmost character will be returned. It can include alphanumeric or symbol characters.
Example
Section titled “Example”SELECT ASCII('A');Output
Section titled “Output”65Explanation
Section titled “Explanation”The ASCII() function in MySQL returns the ASCII value for the specific character. In this example, ‘A’ corresponds to the ASCII value 65.
ASCII(character)
Section titled “ASCII(character)”- character: The character to be evaluated. ASCII(character) returns the ASCII value of the given character as an integer.
Example
Section titled “Example”SELECT ASCII('A') AS ASCII_Value;Output
Section titled “Output” ascii_value------------- 65Explanation
Section titled “Explanation”The ASCII function in PostgreSQL returns the ASCII value of a specific character. In this instance, ‘A’ has been input into the function and the returned ASCII value is 65.
ASCII( string_expression )
Section titled “ASCII( string_expression )”- string_expression: This is a string expression that represents a character. ASCII will return the ASCII code value of the leftmost character of the string. If this character does not have a corresponding ASCII value or if string_expression is NULL, then NULL will be returned.
Example
Section titled “Example”DECLARE @Demo_Variable CHAR
SET @Demo_Variable = CHAR(65)
SELECT ASCII(@Demo_Variable) AS 'ASCII_Value'Output
Section titled “Output”| ASCII_Value ||-------------|| 65 |Explanation
Section titled “Explanation”The code declares a character variable and assigns it the value ‘A’. It then uses the SQL ASCII function to return the ASCII value of the character, which is 65, in the column ‘ASCII_Value’.
ASCII(single_character)
Section titled “ASCII(single_character)”- single_character: This parameter is used to specify the character for which the ASCII equivalent value is to be found. It should be a single, non-null character string. The function returns the ASCII value of this character in the form of a number.
Example
Section titled “Example”SELECT ASCII ('oracle') FROM dual;Output
Section titled “Output”111Explanation
Section titled “Explanation”The ASCII function in Oracle returns the NUMBER code that represents the first character of the input string. In this case, ‘o’ corresponds to the ASCII value of 111.
ASCII(X)
Section titled “ASCII(X)”- x: The input string that is being converted to ASCII. This could include any character or string of characters that the user wishes to interpret as ASCII. The function SQLASCII(X) will convert this input and output the corresponding ASCII numeric value.
Example
Section titled “Example”SELECT ASCII('A') AS Sequency;Output
Section titled “Output”Sequence---------65Explanation
Section titled “Explanation”In the code example, the ASCII() function returns the ASCII code for the first character of the provided string. In this case, the string is ‘A’, and its corresponding ASCII value is 65, as shown in the output.