dbig
New Member
- Joined
- Dec 29, 2011
- Messages
- 29
- Office Version
- 2019
- Platform
- Windows
I have a workbook that pulls data from several oracle tables (same database) based on a common key value or values. Using the Query wizard, I build the core query ... "select * from Table1 where KEYVAL = 'C1234'". Next, I go into Data/Properties, then Connection Properties and convert the query to be parameter driven ... "select * from Table1 where KEYVAL = ?". Now, when I first run the modified query, excel asks me to locate the cell containing the KEYVAL value, e.g. A1. I can also check a box to have it always look in A1 for that parameter value.
My use case is that I want to run the retrieval query on multiple values at once. I can use the "in" operator, e.g. "select * from Table1 where KEYVAL in (?,?,?,?,?)" and supply a different cell for each "?" parameter (A1, A2, A3, A4, A5) and then check each Refresh checkbox, but I could have anywhere from 5 to 30+ parameters for any given refresh. Further, the same KEYVALs are used in an in-line subquery as well.
What I really want is to somehow feed the query via an excel Named Range, something like ...
"select * from Table1 where KEYVAL in (?)" or "select * from Table1 where instr(?, KEYVAL) >0" where the ? is fed the Named Range or a concatenated list of comma separated values.
I've tried both of these constructs without success. Each seems to accept the approach, but neither returns any data.
Anyone have any ideas? Thanks.
My use case is that I want to run the retrieval query on multiple values at once. I can use the "in" operator, e.g. "select * from Table1 where KEYVAL in (?,?,?,?,?)" and supply a different cell for each "?" parameter (A1, A2, A3, A4, A5) and then check each Refresh checkbox, but I could have anywhere from 5 to 30+ parameters for any given refresh. Further, the same KEYVALs are used in an in-line subquery as well.
What I really want is to somehow feed the query via an excel Named Range, something like ...
"select * from Table1 where KEYVAL in (?)" or "select * from Table1 where instr(?, KEYVAL) >0" where the ? is fed the Named Range or a concatenated list of comma separated values.
I've tried both of these constructs without success. Each seems to accept the approach, but neither returns any data.
Anyone have any ideas? Thanks.