I wanted to have a function in PLSQL that would return an set of numbers, and then have a for loop that would iterate over that dataset and do something with it.
Any suggestions ? Does the function need to be a pipeline function for it to be used in the for loop? Do I need to create a new type even though Im just returning numbers?
Thanks!
CREATE OR REPLACE PACKAGE BODY someBody AS
FUNCTION getListOfNumbers RETURN someList IS -- what type do I return ??
BEGIN
RETURN SELECT SID FROM V$SESSION; -- Not sure what do here ??
END;
PROCEDURE soSomeStuff IS
BEGIN
FOR rec IN(getListOfNumbers) -- how do I select from the function?
LOOP
dbms_output.put_line(rec);
END LOOP;
END;
END;