Oracle Tutorial

  • Home
  • Start Here
  • Basics
  • Advanced
    • Oracle View
    • Oracle Index
    • Oracle Synonym
    • Oracle Sequence
    • Oracle Administration
  • PL/SQL
  • Functions
    • Aggregate Functions
    • Analytic Functions
    • Comparison Functions
    • Date Functions
    • String Functions
  • API
    • Python Oracle
Home / Oracle String Functions / Oracle ASCII

Oracle ASCII

The Oracle ASCII function returns an ASCII code value of a character or character expression.

Syntax

ASCII(character_expression)

Arguments

The ASCII() function accepts one argument:

  • character_expression is a character or character expression.

Return values

  • The ASCII() function returns an integer that represents the ASCII code value of the character_expression.
  • If the character_expression consists of more than one character, the ASCII() function will return the ASCII code of the first character only.
  • The ASCII() function returns NULL if the character_expresion is NULL.

Examples

The following statement returns characters code value of charater A, B and C:

SELECT ASCII( 'A' ), ASCII( 'B' ), ASCII( 'C' ) FROM dual;
Oracle ASCII function example

If you pass the ABC string to the ASCII() function, it will return only the ASCII code of the first character as shown in the following example:

SELECT ASCII( 'ABC' ) FROM dual;
Oracle ASCII function string example

The following illustrates how the ASCII() function handles NULL.

SELECT ASCII( NULL ) FROM dual;
Oracle ASCII function - null example

In this example, the ASCII() function returns NULLas we expected.

Remarks

Noted that ASCII stands for American Standard Code for Information Interchange, which is a character encoding standard. For more information on ASCII characters, see the ASCII  page on Wikipedia.

In this tutorial, you have learned how to use the Oracle ASCII() function to ASCII code value of character or character expression.

  • Was this tutorial helpful?
  • YesNo
Next Oracle CHR

Oracle Functions

  • Aggregate Functions
  • Analytic Functions
  • Comparison Functions
  • Date Functions
  • String Functions

String Functions

  • ASCII
  • CHR
  • CONCAT
  • CONVERT
  • DUMP
  • INSTR
  • INITCAP
  • LENGTH
  • LOWER
  • LPAD
  • LTRIM
  • REPLACE
  • REGEXP_COUNT
  • REGEXP_INSTR
  • REGEXP_LIKE
  • REGEXP_REPLACE
  • REGEXP_SUBSTR
  • RPAD
  • RTRIM
  • SOUNDEX
  • SUBSTR
  • TRANSLATE
  • TRIM
  • UPPER

About Oracle Tutorial

OracleTututorial.com website provides Developers and Database Administrators with the updated Oracle tutorials, scripts, and tips.

Search

Recent Tutorials

  • Oracle Implicit Statement Results
  • Calling PL/SQL Stored Functions in Python
  • Calling PL/SQL Procedures in Python
  • Managing Transaction in Python
  • Deleting Data From Oracle Database in Python

Site Links

  • Oracle Books
  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Copyright © 2021 Oracle Tutorial. All Rights Reserved.