O'Reilly logo

Oracle PL/SQL Programming, 5th Edition by Bill Pribyl, Steven Feuerstein

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

Identifiers

An identifier is a name for a PL/SQL object, including any of the following:

  • Constant or variable

  • Exception

  • Cursor

  • Program name: procedure, function, package, object type, trigger, etc.

  • Reserved word

  • Label

Default properties of PL/SQL identifiers are summarized below:

  • Up to 30 characters in length

  • Must start with a letter

  • Can include $ (dollar sign), _ (underscore), and # (hash sign)

  • Cannot contain any “whitespace” characters

If the only difference between two identifiers is the case of one or more letters, PL/SQL normally treats those two identifiers as the same.[12] For example, the following identifiers are all considered by PL/SQL to be the same:

lots_of_$MONEY$
LOTS_of_$MONEY$
Lots_of_$Money$

The following strings are valid names of identifiers:

company_id#
primary_acct_responsibility
First_Name
FirstName
address_line1
S123456

The following identifiers are all illegal in PL/SQL:

1st_year                           -- Doesn't start with a letter
procedure-name                     -- Contains invalid character "-"
minimum_%_due                      -- Contains invalid character "%"
maximum_value_exploded_for_detail  -- Too long
company ID                         -- Has embedded whitespace

Identifiers are the handles for objects in your program and one of your chief means of communicating with other programmers. For this reason, many organizations adopt naming conventions; if your project doesn’t require naming conventions, you will still want to choose variable names carefully...even if you are the only person who will ever see the code!

Although rarely done in practice, you ...

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