给定以下 Oracle 函数:
CREATE or REPLACE FUNCTION foo(id NUMBER, category VARCHAR) RETURN CHAR IS
TYPE MY_ARRAY2 IS TABLE OF NUMBER;
MY_ARRAY MY_ARRAY2;
BEGIN
SELECT my_id BULK COLLECT INTO my_array FROM my_table
RETURN (
CASE WHEN category = 'FOO' AND (id member of MY_ARRAY)
THEN 'Y'
ELSE 'N'
END
);
END;
查找的性质是什么:
SELECT my_id BULK COLLECT INTO my_array FROM my_table
或者,换句话说,有什么我可以添加到这条线或其他地方来加快查找速度 - 也许是一个索引?