O'Reilly logo

Oracle PL/SQL Language Pocket Reference by Chip Dawes, Steven Feuerstein, Bill Pribyl

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

A-Z, a-z

Digits

0-9

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

'That''s Entertainment!'

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required