Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can PL/SQL return entire record? 1

Status
Not open for further replies.

moepower

Programmer
Oct 5, 2000
93
US
If I type:
select *
from emp;

I would get all records for table emp.

Could Oracle8 do something similar to this. ie. Could I create an out variable that will return all the records that I query from a table?

Oracle7 is weak in this area, I'm hoping that Oracle8 or 8i have changed this.

Thanks,
 
You Certainly Can!!

If you look through the Oracle PL/SQL Documentation (Check it out at technet.oracle.com if you don't have it to hand) and look for Collections, you should be OK.

You can do it as either Varrays or nested tables or something else I can't remeber the name of.

You could declare a type called

TYPE element_type emp%rowtype;

TYPE type_name IS TABLE OF element_type INDEX BY BINARY_INTEGER;

out_var type_name;

out var would then be an array of records of the emp table.

I hope this helps,

Mike.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top