If you want to use your list outside of PL/SQL, as in your post, you need to define an OBJECT
type in the database. E.g.,
CREATE OR REPLACE TYPE my_string AS OBJECT (val varchar2(4000));
CREATE OR REPLACE TYPE my_string_t AS TABLE OF my_string;
... and then use my_string_t
in place of your PL/SQL strings_t
type.
As long as your list of strings has fewer than 32768 elements, you can use the pre-defined SYS.ODCIVARCHAR2LIST
object type instead, saving you the need to declare any new object types.
E.g.,
CREATE OR REPLACE PACKAGE teststr AS
FUNCTION strings RETURN sys.odcivarchar2list;
END teststr;
CREATE OR REPLACE PACKAGE BODY teststr AS
FUNCTION strings RETURN sys.odcivarchar2list IS
l_list sys.odcivarchar2list;
BEGIN
SELECT rownum
BULK COLLECT INTO l_list
FROM DUAL
CONNECT BY ROWNUM <= 1000;
RETURN l_list;
END strings;
END teststr;
SELECT * FROM table(teststr.strings);