GBQ lets perform the the following statement which is very good at improving my query efficiency:
DECLARE practices ARRAY<INT64>;
SET practices = (SELECT ARRAY(select distinct id from business));
select *
from business
where business.id in UNNEST(practices)
How can I accomplish this same type of prefetch against an Oracle DB w/ Oracle SQL? I'd like to use one set of similar SQL statements to refactor existing Oracle SQL queries instead of inefficient CTE's.
P.S. I've looked at other solutions like How to declare variable and use it in the same Oracle SQL script? however, those solutions don't appear to be working in Oracle SQL for me and/or they are listed on separate execution lines against PL/SQL.
I.e. does not work:
DECLARE practices = 'My Practice Name';
select *
from business
where business.name = '&practices'