I’m struggling with PL/SQL functions. I’m trying to write a function which would take in a table of objects, filter that table, based on some criteria (I intend to test values against other tables) and the return filtered table.
My table type is defined as follows:
CREATE TYPE test_obj AS OBJECT (test_id NUMBER(16,0), test_name VARCHAR2(50));
CREATE TYPE test_tbl AS TABLE OF test_obj;
The function might look like this.
CREATE OR REPLACE
FUNCTION filterme(i_test IN test_tbl) RETURN test_tbl AS
o_test test_tbl;
BEGIN
--NOT WORKING: SELECT INTO o_test FROM i_test t WHERE t.test_id > 10;
RETURN o_test;
END filterme;
But what do I put inside?
1 Answer