sql >> Base de Datos >  >> RDS >> Oracle

En PL/SQL, tome una tabla como parámetro, fíltrela y devuélvala


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;