Home » SQL & PL/SQL » SQL & PL/SQL » using object tables (Win XP, 10G)
using object tables [message #324185] Sat, 31 May 2008 05:38 Go to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Hi,

I am testing the usage of object table to display the contents of a table but not able to construct the arguments properly. Can anyone tell me what step should be corrected.


create or replace type ob_alphabets as object (alpha char(1));
create table alphabets of ob_alphabets;


Quote:
inserted A to Z into alphabets


create or replace type ob_tabalpha as table of ob_alphabets;


declare 
a ob_tabalpha = new ob_tabalpha(); 
cursor c1 is select * from alphabets; 
b c1%rowtype; 
i int := 0; 
begin 
for c in c1 loop 
a(i):= c; 
i:=i+1; 
end loop; 
for i in 1..26 
loop 
dbms_output.put_line(a(i)); 
end loop; 
end;


[Updated on: Sun, 01 June 2008 00:44] by Moderator

Report message to a moderator

Re: using object tables [message #324194 is a reply to message #324185] Sat, 31 May 2008 08:11 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
after a few hours of search I got it..

Quote:
use object of data type (not another object)


/*initiate*/ a (data type) := data type();

begin

a.extend(count of records)

a(1) := record


Thanks

- Das
Re: using object tables [message #324238 is a reply to message #324185] Sat, 31 May 2008 19:15 Go to previous message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
thanks for taking the time to post your solution. Most people would not have bothered. You have shown good forum etiquette. It is much appreciated.

Kevin
Previous Topic: ACCEPT and PROMPT
Next Topic: In Oracle Report I need to Get the Date
Goto Forum:
  


Current Time: Fri Dec 09 06:18:08 CST 2016

Total time taken to generate the page: 0.26891 seconds