I\'m trying to perform a SELECT
with an IN
clause and I would like to be able to have the results returned in the same order as the elements in my list
You can concatenate your variables and order by instr on it like below. I e cannot vouch for the efficiency of this - but must be Okey.Your front end will obviously have to do a bit more work.But constructing a query like this can be open to sql Injection.
SELECT * FROM orders WHERE order_no IN ('B123', 'B483', 'B100', 'B932', ...)
ORDER BY
instr ('@B123@'|| '@B483@'||'@B100@'||'@B932@'||... ,'@'|| order_no||'@')