Identifiers
An identifier is a name for a PL/SQL object, including any of the following:
Constant
Scalar variable
Composite variable (record or collection)
Exception
Procedure
Function
Package
Type
Cursor
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#
(pound sign)Cannot contain spaces
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.[8] 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 -- Starts with numeral procedure-name -- Contains invalid character "-" minimum_%_due -- Contains invalid character "%" maximum_value_exploded_for_detail -- Name is too long company ID -- Cannot have embedded spaces in name
Identifiers are the handles for objects in your program. Be sure to name your objects carefully so the names describe the objects and their uses. Avoid identifier names like X1 and temp; they are too ambiguous to mean anything to you or to anyone else reading your code.
Although rarely done in practice, you can actually break some of these rules by surrounding identifiers with double ...
Get Oracle PL/SQL Programming, Third 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.