Given the following Oracle function:
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;
What's the nature of the lookup of:
SELECT my_id BULK COLLECT INTO my_array FROM my_table
Or, put differently, is there anything that I can add to this line or elsewhere to speed up the look-up - perhaps an index?