Home » SQL & PL/SQL » SQL & PL/SQL » table type
table type [message #234875] Thu, 03 May 2007 06:47 Go to next message
janardhanam.k
Messages: 29
Registered: April 2007
Junior Member
Hi,
The following code is giving this error at the line dbms_output.put_line.
CREATE OR REPLACE procedure test as
cursor abc is
select Day d
from all_dates;
type xyz_type is table of abc%rowtype
index by binary_integer;
xyz xyz_type;
begin
open abc;
fetch abc bulk collect into xyz;
for i in 1..10 loop
dbms_output.put_line(to_char(xyz(i)));
end loop;
end;
/

can any one help?
Re: table type [message #234877 is a reply to message #234875] Thu, 03 May 2007 06:53 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read How to format your posts and post a copy and paste of your execution not blabla.
Always give version number.
Always give the error message not just a get an error.

Regards
Michel
Re: table type [message #234891 is a reply to message #234877] Thu, 03 May 2007 07:14 Go to previous messageGo to next message
janardhanam.k
Messages: 29
Registered: April 2007
Junior Member
sorry for not sending it in correct format.This is copy paste of my excution.Any help in this regard will be appreciated.

1 CREATE OR REPLACE procedure test as
2 cursor abc is
3 select Day d
4 from all_dates;
5 type xyz_type is table of abc%rowtype
6 index by binary_integer;
7 xyz xyz_type;
8 begin
9 open abc;
10 fetch abc bulk collect into xyz;
11 for i in 1..10 loop
12 dbms_output.put_line(to_char(xyz(i)));
13 end loop;
14* end;
SQL> /

Warning: Procedure created with compilation errors.

SQL> show err;
Errors for PROCEDURE TEST:

12/1 PL/SQL: Statement ignored
12/22 PLS-00306: wrong number or types of arguments in call to
'TO_CHAR'
Re: table type [message #234893 is a reply to message #234891] Thu, 03 May 2007 07:17 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You don't read the link I provided or don't want to format your post. Use the CODE tags!

xyz(i) is not a value, it is a record.
You have to use xyz(i).day.

Regards
Michel
Re: table type [message #234897 is a reply to message #234875] Thu, 03 May 2007 07:23 Go to previous message
janardhanam.k
Messages: 29
Registered: April 2007
Junior Member
Sorry for not formatting the code.Thanks for the help.My code is working now.
Previous Topic: Granting permission to schema
Next Topic: Auditing
Goto Forum:
  


Current Time: Wed Dec 07 08:25:53 CST 2016

Total time taken to generate the page: 0.05400 seconds