Home » RDBMS Server » Server Administration » Syntax question
Syntax question [message #371237] Fri, 22 September 2000 02:11 Go to next message
Laert
Messages: 20
Registered: January 2000
Junior Member
Hi!!

Can someone help me to write correct following:

DECLARE
TYPE NumList IS TABLE OF number(10);
nums NumList := NumList(10);
BEGIN
nums.extend(100);
SELECT MyNums INTO nums from Nums_table where ID > 1 AND ID < 100;

end;
/

The problem is how can I insert many rows into temporary table declared at the begining of script.

Thanx in advance
Laert
Re: Syntax question [message #371242 is a reply to message #371237] Fri, 22 September 2000 10:10 Go to previous message
Suresh
Messages: 189
Registered: December 1998
Senior Member
DECLARE
TYPE NumList IS TABLE OF number(10) ;
nums NumList := NumList(10);
i number := 0;
BEGIN
nums.extend(100);
for crec in (SELECT mynums from nums_table where id>1 and id <100) loop
i := i+1;
nums(i):=crec.mynums;
end loop;
dbms_output.put_line (nums(5)); -- to check 5th value in nested table
end;

[b]Suresh[b]
Previous Topic: Does anyone know if you can get a record from a dynamic query cursor?
Next Topic: Help! Need to create to a fixed width file
Goto Forum:
  


Current Time: Fri Apr 19 20:18:51 CDT 2024