Chapter 8. Strings

Variables with character datatypes store text and are manipulated by character functions. Because character strings are “free-form,” there are few rules concerning their content. For example, you can store numbers and letters, as well as any combination of special characters, in a character-type variable. There are, however, several different kinds of character datatypes, each of which serves a particular purpose.

Tip

CLOB (character large object) and LONG, while arguably character types, cannot be used in the same manner as the character types discussed in this chapter, and are more usefully thought of as large object types. We discuss large object types in Chapter 12.

The Impact of Character Sets

Working with strings used to be a short and simple topic. However, as applications have grown more international in nature, Oracle’s support for different character sets, especially Unicode, has expanded, and a good understanding of character set issues is now almost a necessity when working with strings.

What Is a Character Set?

A character set is a mapping between a set of characters meaningful to humans and a set of bit sequences used to represent those characters in a computer or on a disk. 7-bit ASCII is a commonly used character set in the United States. Each 7-bit ASCII character is represented as a sequence of seven bits within an eight-bit byte. The letter G, then, is represented as 0100 0111. Look at that same string of bits as a number, and you end up with ...

Get Oracle PL/SQL Programming, 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.