I have a schema RTRD_W built in an Oracle 11g database that contains a table rtrd_pri that has a column NOMNL which is has a type defined as VARRAY(10) OF KPS_ADM.NUMBER_T (an object defined as a type in the KPS_ADM schema). I am trying to run a query to retrieve the KPS_ADM.NUMBER_T object inside the varray but I keep getting an error returned in my SQL syntax. The function I built is posted below
CREATE or replace function RETRIEVEPRIREF RETURN KPS_ADM.NUMBER_T AS
REF1 KPS_ADM.NUMBER_T;
BEGIN
SELECT KPS_ADM.NUMBER_T INTO REF1 from table(NOMNL) WHERE (SELECT NOMNL FROM RTRD_W.rtrd_pri WHERE (syst_id like '%0516%'));
RETURN REF1;
END RETRIEVEPRIREF;
I know the query :SELECT NOMNL FROM RTRD_W.rtrd_pri WHERE (syst_id like '%0516%')
works and does return a varray with a single KPS_ADM.NUMBER_T object inside it, but I can't seem to get the syntax right for searching inside the varray to retrieve the object.
Can anyone show the proper syntax to do this?