Oracle
 sql >> Database >  >> RDS >> Oracle

In PL/SQL, prendi una tabella come parametro, filtrala e restituiscila


CREATE OR REPLACE FUNCTION filterme(i_test IN test_tbl)
RETURN test_tbl
AS
  ret_tab test_tbl = test_tbl();
begin
  for i in 1 .. i_test.count loop
    if i_test(i).test_id > 10 then /* do the test */
      ret_tab.extend(1);
      ret_tab(ret_tab.count) := i_test(i);
    end if;
  end loop;
  return ret_tab;
end;