PL/SQL Language Fundamentals
This section summarizes the fundamental components of the PL/SQL language: characters, identifiers, literals, delimiters, use of comments and pragmas, and construction of statements and blocks.
PL/SQL Character Set
The PL/SQL language is constructed from letters, digits, symbols, and whitespace, as defined in the following table:
Type |
Characters |
---|---|
Letters |
A-Z, a-z |
Digits |
0-9 |
Symbols |
~!@#$%^&*( )_-+=|[ ]{ }:;"'< >,.?/ ^ |
Whitespace |
space, tab, newline, carriage return |
Characters are grouped together into four lexical units: identifiers, literals, delimiters, and comments.
Identifiers
Identifiers are names for PL/SQL objects such as constants, variables, exceptions, procedures, cursors, and reserved words. Identifiers have the following characteristics:
Can be up to 30 characters in length
Cannot include whitespace (space, tab, carriage return)
Must start with a letter
Can include a dollar sign ($), an underscore ( _ ), and a pound sign (#)
Are not case-sensitive
In addition, you must not use PL/SQL’s reserved words as identifiers. For a list of those words, see the table in the final section in this book, Section 1.20.
If you enclose an identifier within double quotes, then all but the first of these rules are ignored. For example, the following declaration is valid:
DECLARE "1 ^abc" VARCHAR2(100); BEGIN IF "1 ^abc" IS NULL THEN ... END;
Boolean, Numeric, and String Literals
Literals are specific values not represented by identifiers. For example, ...
Get Oracle PL/SQL Language Pocket Reference, Second 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.