Home » Other » Training & Certification » Bulk collect - how to get the output
Bulk collect - how to get the output [message #286332] Fri, 07 December 2007 03:20 Go to next message
sudharshan
Messages: 48
Registered: November 2006
Member
DECLARE

TYPE dept_coll IS TABLE OF dept%ROWTYPE;
dept_list dept_coll;

BEGIN

SELECT *
BULK COLLECT INTO dept_list
FROM dept;

dbms_output.put_line('the value is '||dept_list.deptno);
END;


1.it is throwing an error? how to loop through and get the records?

2.what is the advantage over cursor?


regards
sudharshan

Re: Bulk collect - how to get the output [message #286337 is a reply to message #286332] Fri, 07 December 2007 03:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
1. What happen when you tried?
2. Why do you think about this?

We don't do your homework.
First post your opinion/solution, then we help.

Also read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Always post your Oracle version (4 decimals).

Regards
Michel
Re: Bulk collect - how to get the output [message #286338 is a reply to message #286332] Fri, 07 December 2007 03:23 Go to previous messageGo to next message
kir_ait
Messages: 198
Registered: November 2007
Location: Bangalore,India
Senior Member

What error you are getting?

Paste the error and format your codes.

Kiran.
Re: Bulk collect - how to get the output [message #286349 is a reply to message #286332] Fri, 07 December 2007 03:34 Go to previous messageGo to next message
sudharshan
Messages: 48
Registered: November 2006
Member


i get this error

ERROR at line 12:
ORA-06550: line 12, column 49:
PLS-00302: component 'DEPTNO' must be declared
ORA-06550: line 12, column 1:
PL/SQL: Statement ignored

when i change the statement

dbms_output.put_line('the value is '||dept_list(dept_list.first).deptno);

i get the answer but how to get all the columns say dname,loc.

Re: Bulk collect - how to get the output [message #286352 is a reply to message #286349] Fri, 07 December 2007 03:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Same way with other name.
And for other results: increment the index.

Regards
Michel
Re: Bulk collect - how to get the output [message #286437 is a reply to message #286352] Fri, 07 December 2007 06:37 Go to previous message
sudharshan
Messages: 48
Registered: November 2006
Member
Thanks for spending your valuable time.



Regards
Sudharshan.
Previous Topic: IZO-007 dumps and tips...
Next Topic: OCP Certification study material
Goto Forum:
  


Current Time: Sat Nov 23 18:06:19 CST 2024