PL/SQL Language Fundamentals
The 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 |
|
Digits |
|
Symbols |
|
Whitespace |
space, tab, carriage return |
Characters are grouped together into the 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:
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
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;
Literals
Literals are specific values not represented by identifiers. For example, TRUE, 3.14159, 6.63E-34, ‘Moby Dick', and NULL are all literals of type Boolean, number, or string. There are no date or complex datatype literals as they are internal representations. Unlike the rest of PL/SQL, literals are case-sensitive. To embed single quotes within a string literal, place two single quotes next to each other. See the following table for examples.
Literal |
Actual Value |
---|---|
|
Get Oracle PL/SQL Language Pocket Reference 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.