11.14. Miscellaneous String Functions

The following list includes common string functions that are used in PL/SQL.

ASCIIReturns the decimal representation of a number. The argument is a character. The following SELECT returns 65. The functions ASCII and CHR perform reverse functions. SELECT ASCII('A') FROM dual;
CHRReturns the character equivalent of a decimal number. The argument is a decimal number. The result is the ASCII character. The following returns the letter A:

SELECT CHR(65) FROM dual;

Suppose you want to include the ASCII character (&) in a PL/SQL program. This applies to SQL*Plus. Realizing that (&) is a SQL*Plus special character that denotes a command line argument, you first determine the decimal equivalent.

 SQL> SELECT ASCII('&') ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.