I need to run a query on generated generated column names.
Here’s the query:
select 'col_'||4 from MY_TABLE
Note:
- “4” is a variable that is passed to this query from within the Java code
- MY_TABLE is a table that contain columns with names (col_4, col_5, etc..)
Inside Oracle you need use dynamic SQL. (YourVariable value is 4 for your example)
From Java you can build any SQL and execute them