Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to fix these bugs!!!
Your problem originates in the cursor SELECT statement:
> cursor all_object is
> select *
> from firms f ,Co_bg c ,FileUrl u
> where f.co_name='A' and f.co_id=c.co_id and f.co_id=u.co_id
> order by f.co_name;
In this query, 2 or more tables have columns with the same name (for example, FIRMS.CO_ID, CO_BG.CO_ID and FILE_URL.CO_ID).
For a cursor to be OPENed, it is required that each of its columns has a unique name.
Since you're selecting ALL columns from ALL tables (SELECT *), PL/SQL finds an ambiguity that generates the PLS-00402 error.
The workaround: assign a unique alias to each duplicate column name so that each occurrence can be distinguished from the others.
Your rephrased cursor would look something like:
CURSOR all_object IS SELECT f.co_id AS f_id, . . . c.co_id AS c_id, . . . u.co_id AS u_id, . . . FROM firms f , Co_bg c, FileUrl u WHERE f.co_name = 'A' AND f.co_id = c.co_id AND f.co_id = u.co_id ORDER BY f.co_name;Received on Sat Mar 15 1997 - 00:00:00 CST