问题
I tried researching this but am a little stuck. I need to prompt a user to enter a value (single, multiple or all) for a report that only takes a "Select" statement from Oracle. For example, user can enter a store# as "07" (single value), "07", "08" (as multiple values ), or a result bringing back all store#'s. I had the following below, but unfortunately it does not work in the program we are using from our company as every prompt field is mandatory in their program so my sql below won't work. I need something where there is 1 prompt parameter where the user can enter one store, multiple stores or all stores are returned. Any help would be appreciated.
select d.sale_date,d.slip_no,d.extension_amount
from sale_details d
where
('&ALL_SITES'='Y' or (site_id='&SITE_ID1' and '&ALL_SITES' is null) and
union all
select d.sale_date,d.slip_no,d.extension_amount
from sale_details d
where
(site_id='&SITE_ID2' and '&ALL_SITES' is null)
来源:https://stackoverflow.com/questions/40456230/prompt-user-to-enter-single-multiple-or-all-values-in-oracle-select-query