I have a table with numerical values and I want to fetch that values into an array. Can I do that? Is there a function that allows me to do this? I am relatively new to pl/sql and I don't know. Thanks!
set serveroutput on;
DECLARE
TYPE v_arr IS VARRAY(100) OF NUMBER;
var v_arr;
return_value number;
BEGIN
var:=v_arr();
FOR c1 IN (SELECT ID FROM table_name WHERE ROWNUM<100)
loop
var.EXTEND;
var(var.last):=c1.id;
end loop;
FOR i IN var.FIRST..var.LAST
loop
return_value:=var(i);
dbms_output.put_line(return_value);
end loop;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With