×
☰ See All Chapters

Oracle ASCII Function

Oracle ASCII function returns ASCII value of first character from a string.

Oracle ASCII Function Syntax

ASCII(arg)

arg is the argument for which you want get the ASCII value for first character. This can be an expression or a direct value or a value from a column of any type.

Oracle ASCII Function Example

Creating table for demonstrating ASCII Function

CREATE TABLE NAME

(

  FNAME  VARCHAR(10 )    NOT NULL,

  LNAME  VARCHAR(10 )

);

Insert into NAME (FNAME, LNAME) Values ('ADI', 'TEMP');

Insert into NAME (FNAME, LNAME) Values ('NAVEEN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('HARISH', 'GOWDA');

Insert into NAME (FNAME, LNAME) Values ('HARI', 'PRASAD');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('KIRAN', 'KUMAR');

COMMIT;

Example 1

SELECT FNAME,LNAME,ASCII(FNAME)

FROM NAME

oracle-ascii-function-0

Example 2

SELECT FNAME,LNAME,ASCII('M')

FROM NAME

oracle-ascii-function-1


All Chapters
Author