This chapter explains these aspects(方面) of the PL/SQL language:
■ Character Sets
■ Lexical Units(词法单元)
■ Declarations
■ References to Identifiers(引用标识符)
■ Scope and Visibility of Identifiers(标识符的范围和可见性)
■ Assigning Values to Variables
■ Expressions
■ Error-Reporting Functions
■ SQL Functions in PL/SQL Expressions
■ Pragmas
■ Conditional Compilation
Character Sets
Any character data to be processed by PL/SQL or stored in a database must be represented(表示) as a sequence of bytes(一个字节序列).
The byte representation of a single character is called a character code.
A set of character codes is called a character set.
Every Oracle database supports a database character set and a national character set.
PL/SQL also supports these character sets.
This document explains how PL/SQL uses the database character set and national character set.
Topics
■ Database Character Set
■ National Character Set
PL/SQL uses the database character set to represent:
■ Stored source text of PL/SQL units
For information about PL/SQL units, see “PL/SQL Units and Compilation Parameters” on page 1-10.
■ Character values of data types CHAR, VARCHAR2, CLOB, and LONG
For information about these data types, see “SQL Data Types” on page 3-2.
The database character set can be either single-byte, mapping each supported character to one particular byte(每个支持的字符映射到一个特定的字节), or multibyte-varying-width(多字节不同宽度), mapping each supported character to a sequence of(一系列) one, two, three, or four bytes.
The maximum number of bytes in a character code depends on the particular character set.
Every database character set includes these basic characters:
■ Latin letters(拉丁字母): A through Z and a through z
■ Decimal digits(小数位数): 0 through 9
■ Punctuation characters(标定符号) in Table 2–1
■ Whitespace characters(空格字符): space, tab, new line, and carriage return(回车)
PL/SQL source text that uses only the basic characters can be stored and compiled in any database.
PL/SQL source text that uses nonbasic characters can be stored and compiled only in databases whose database character sets support those nonbasic characters.
Table 2–1 Punctuation Characters in Every Database Character Set
![2PL/SQLLanguageFundamentals(基本原理)]()
![2PL/SQLLanguageFundamentals(基本原理)]()
![2PL/SQLLanguageFundamentals(基本原理)]()
■ Character Sets
■ Lexical Units(词法单元)
■ Declarations
■ References to Identifiers(引用标识符)
■ Scope and Visibility of Identifiers(标识符的范围和可见性)
■ Assigning Values to Variables
■ Expressions
■ Error-Reporting Functions
■ SQL Functions in PL/SQL Expressions
■ Pragmas
■ Conditional Compilation
Character Sets
Any character data to be processed by PL/SQL or stored in a database must be represented(表示) as a sequence of bytes(一个字节序列).
The byte representation of a single character is called a character code.
A set of character codes is called a character set.
Every Oracle database supports a database character set and a national character set.
PL/SQL also supports these character sets.
This document explains how PL/SQL uses the database character set and national character set.
Topics
■ Database Character Set
■ National Character Set
See Also: Oracle Database Globalization Support Guide for general information about character sets
Database Character SetPL/SQL uses the database character set to represent:
■ Stored source text of PL/SQL units
For information about PL/SQL units, see “PL/SQL Units and Compilation Parameters” on page 1-10.
■ Character values of data types CHAR, VARCHAR2, CLOB, and LONG
For information about these data types, see “SQL Data Types” on page 3-2.
The database character set can be either single-byte, mapping each supported character to one particular byte(每个支持的字符映射到一个特定的字节), or multibyte-varying-width(多字节不同宽度), mapping each supported character to a sequence of(一系列) one, two, three, or four bytes.
The maximum number of bytes in a character code depends on the particular character set.
Every database character set includes these basic characters:
■ Latin letters(拉丁字母): A through Z and a through z
■ Decimal digits(小数位数): 0 through 9
■ Punctuation characters(标定符号) in Table 2–1
■ Whitespace characters(空格字符): space, tab, new line, and carriage return(回车)
PL/SQL source text that uses only the basic characters can be stored and compiled in any database.
PL/SQL source text that uses nonbasic characters can be stored and compiled only in databases whose database character sets support those nonbasic characters.
Table 2–1 Punctuation Characters in Every Database Character Set



See Also: Oracle Database Globalization SuppZ