Home » SQL & PL/SQL » SQL & PL/SQL » colection error
colection error [message #224708] Thu, 15 March 2007 03:51 Go to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
Hi,

i am geting error in fallowing code ..any body can suggest some thing..

1) create or replace type testobj is object
(id number,
name varchar2(30))


2) create or replace type test_obj_rec is table of testobj

3)


DECLARE
t_test test_obj_rec := test_obj_rec();
BEGIN
t_test.extend(1);
t_test(1) := test_obj_rece(1,'Test row 1');


for i in t_test.first .. t_test.last loop
dbms_output.put_line('Samp_Id='||t_test(i).id||' samp_name='||t_Test(i).name);
end loop;

end;


error

ORA-06550: line 5, column 16:
PLS-00201: identifier 'TEST_OBJ_RECE' must be declared
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored


Thanks,
Yash
Re: colection error [message #224710 is a reply to message #224708] Thu, 15 March 2007 03:58 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
t_test(1) := test_obj_rece(1,'Test row 1');

What is test_obj_rece?

IMHO it's error. Try:


t_test(1) := TEST_OBJ_REC(1,'Test row 1');

HTH.
Michael
Re: colection error [message #224714 is a reply to message #224708] Thu, 15 March 2007 04:07 Go to previous messageGo to next message
ammishra
Messages: 179
Registered: January 2007
Location: india
Senior Member
Hi Michael

this is typo mistake.

DECLARE
t_test test_obj_rec := test_obj_rec();
BEGIN
t_test.extend(1);
t_test(1) := test_obj_rec(1,'Test row 1');


for i in t_test.first .. t_test.last loop
dbms_output.put_line('Samp_Id='||t_test(i).id||' samp_name='||t_Test(i).name);
end loop;

end;
ORA-06550: line 5, column 14:
PLS-00306: wrong number or types of arguments in call to 'TEST_OBJ_REC'
ORA-06550: line 5, column 14:
PLS-00306: wrong number or types of arguments in call to 'TEST_OBJ_REC'
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored


Thanks,
Yash
Re: colection error [message #224782 is a reply to message #224714] Thu, 15 March 2007 08:02 Go to previous message
dmitry.nikiforov
Messages: 723
Registered: March 2005
Senior Member
test_obj_rec type is table of objects.

Each element of this collection is OBJECT of testobj type.
Has to be:

DECLARE
t_test test_obj_rec := test_obj_rec();
BEGIN
t_test.extend(1);
t_test(1) := testobj(1,'Test row 1');
for i in t_test.first .. t_test.last loop
dbms_output.put_line('Samp_Id='||t_test(i).id||' samp_name='||t_Test(i).name);
end loop;
end;

Rgds.

[Updated on: Thu, 15 March 2007 08:03]

Report message to a moderator

Previous Topic: Reverse key index
Next Topic: Is it possible to determine if a column has been updated inside a trigger
Goto Forum:
  


Current Time: Thu Dec 08 10:49:00 CST 2016

Total time taken to generate the page: 0.09691 seconds