Oracle Bug - PLSQL variable names [message #296914] |
Tue, 29 January 2008 08:10  |
amcghie
Messages: 35 Registered: March 2005 Location: Sunny Dubai
|
Member |
|
|
Can anyone tell me if the following is an Oracle Bug. I don't seem to be able to declare a PLSQL variable where the variable name is the same as a table and column.
For example:
CREATE TABLE week_day
( week_day_id NUMBER NOT NULL
, week_day VARCHAR2(3) NOT NULL );
DECLARE
week_day week_day.week_day%TYPE;
BEGIN
NULL;
END;
/
Running this code gives the following error:
ERROR at line 2:
ORA-06550: line 2, column 12:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 2, column 12:
PL/SQL: Item ignored
Normally I would prefix my variables in PLSQL with l_ (or whatever depending on scope), but I discovered this "feature" when declaring a field in a PLSQL record.
Anyone else seen this?
Cheers
|
|
|
|
Re: Oracle Bug - PLSQL variable names [message #296939 is a reply to message #296915] |
Tue, 29 January 2008 09:49   |
amcghie
Messages: 35 Registered: March 2005 Location: Sunny Dubai
|
Member |
|
|
Hi Michel,
I looked at the docs and couldn't see any reference to a restriction like this. It seems the way round the issue is to prefix the table name with the schema name in the declaration:
DECLARE
week_day dev.week_day.week_day%TYPE;
BEGIN
NULL;
END;
/
|
|
|
|