Compile-Time Warnings for Oracle DB 10g - PLW-05004: identifier string is also declared in STANDARD or is a SQL built-in
(Page 3 of 4 )
Many PL/SQL developers are unaware of the STANDARD package, and its implications for their PL/SQL code. For example, it is common to find programmers who assume that names like INTEGER and TO_CHAR are reserved words in the PL/SQL language. That is not the case. They are, respectively, a datatype and a function declared in the STANDARD package.
STANDARD is one of the two default packages of PL/SQL (the other is DBMS_STANDARD). Because STANDARD is a default package, you do not need to qualify references to datatypes like INTEGER, NUMBER, PLS_INTEGER, etc., with “STANDARD”—but you could, if you so desired.
PLW-5004 notifies you if you happen to have declared an identifier with the same name as an element in STANDARD (or a SQL built-in; most built-ins—but not all—are declared in STANDARD).
Consider this procedure definition:
1 CREATE OR REPLACE PROCEDURE plw5004
2 IS
3 INTEGER NUMBER;
4
5 PROCEDURE TO_CHAR
6 IS
7 BEGIN
8 INTEGER := 10;
9 END TO_CHAR;
10 BEGIN
11 TO_CHAR;
12 * END plw5004;
Compile-time warnings for this procedure will display as follows:
LINE/COL ERROR
-------- ---------------------------------
3/4 PLW-05004: identifier INTEGER is
also declared in STANDARD or is a
SQL builtin
5/14 PLW-05004: identifier TO_CHAR is
also declared in STANDARD or is a
SQL builtin
You should avoid reusing the names of elements defined in the STANDARD package unless you have a very specific reason to do so.
Next: PLW-05005: function string returns without value at line string >>
More Oracle Articles
More By O'Reilly Media
|
This article is excerpted from chapter 20 of the book Oracle PL/SQL Programming, Fourth Edition, written by Steven Feuerstein and Bill Pribyl (O'Reilly; ISBN: 0596009771). Check it out today at your favorite bookstore. Buy this book now.
|
|