Use cell values from worksheet as part of SQL parameters

155 Views Asked by At

I used a parameterized query (where IDVALUE=?) to retrieve data from Oracle database with MS Excel. That works for me to input the parameter value (numeric). But for text/ string in cell A1 as ID, I have tried the following:

SELECT * FROM Table WHERE ID ="'?'"
SELECT * FROM Table WHERE ID ='?'
SELECT * FROM Table WHERE ID =?
  • Input 'ABC123' with/ without a single quote in cell A1
  • Use formula =CHAR(39)&A1&CHAR(39)

None of them works.

Read through this before, I still can't find success How to use parameterized query in Excel using column as parameter?

Your ideas/ suggestions are welcome.

0

There are 0 best solutions below