PLS-00302: component 'A' must be declared [message #335716] |
Wed, 23 July 2008 07:09 |
jyothsna1612
Messages: 68 Registered: June 2008
|
Member |
|
|
Hi,
I tried to get the o/p of table's column with the collections
but giving the error.I searched for this unable to grasp why the error.
I need suggestion in my code.
SQL> declare
2 type typ_dup1 is table of dup1%rowtype;
3 v_dup1 typ_dup1;
4 begin
5 select * bulk collect into v_dup1 from dup1;
6 dbms_output.put_line(v_dup1.a);
7 end;
8 /
dbms_output.put_line(v_dup1.a);
*
ERROR at line 6:
ORA-06550: line 6, column 29:
PLS-00302: component 'A' must be declared
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
SQL> desc dup1
Name Null? Type
----------------- ------------
A NUMBER
Thanks
|
|
|
Re: PLS-00302: component 'A' must be declared [message #335718 is a reply to message #335716] |
Wed, 23 July 2008 07:13 |
jyothsna1612
Messages: 68 Registered: June 2008
|
Member |
|
|
Hi,
I'm sorry in hurry i forgot to format the code.
DECLARE
TYPE TYP_DUP1 IS TABLE OF DUP1%ROWTYPE;
V_DUP1 TYP_DUP1;
BEGIN
SELECT *
BULK COLLECT INTO V_DUP1
FROM DUP1;
DBMS_OUTPUT.PUT_LINE(V_DUP1.A);
END;
ERROR at line 6:
ORA-06550: line 6, column 29:
PLS-00302: component 'A' must be declared
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
|
|
|
|
|
Re: PLS-00302: component 'A' must be declared [message #335870 is a reply to message #335716] |
Thu, 24 July 2008 01:05 |
jyothsna1612
Messages: 68 Registered: June 2008
|
Member |
|
|
Hi
I tried with the following code . Still getting error
DECLARE
TYPE TYP_DUP1 IS TABLE OF DUP1%ROWTYPE;
V_DUP1 TYP_DUP1;
BEGIN
SELECT A
BULK COLLECT INTO V_DUP1
FROM DUP1;
FOR I IN V_DUP1.FIRST.. V_DUP1.LAST LOOP
DBMS_OUTPUT.PUT_LINE(V_DUP1(I).A);
END LOOP;
END;
/
but getting the error
********************
declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 6
********************
Thanks
Jyothsna
|
|
|
|
|
|
|
Re: PLS-00302: component 'A' must be declared [message #335882 is a reply to message #335877] |
Thu, 24 July 2008 01:34 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
raghu2110 wrote on Thu, 24 July 2008 08:18 | When you are using a PL/SQL record it has to be indexed by a binary integer
|
This is not true as the provided examples prove it.
You should upgrade your PL/SQL knowledge from V7 to at least 10.2, collections were introduced in 8.0.
Regards
Michel
|
|
|