I am trying to access a column name to order a query in an application that interacts with an Oracle database. I want to use a bind variable so that I can dynamically change the order of the request.
The problem I ran into is that the database seems to be ignoring column order.
Does anyone know if there is a way to refer to a database column through a bind variable, or if possible?
for example my request
SELECT * FROM PERSON ORDER BY :1
(where it :1will be attached to PERSON.NAME) The query does not return the results in alphabetical order, I am worried that the database interprets this as: -
SELECT * FROM PERSON ORDER BY 'PERSON.NAME'
which obviously will not work.
Any suggestions are greatly appreciated.