3

I was executing a simple sql query ="

select id, first_name, last_name, city
from customer where id = :id

and using namedParamterJdbcTemplate to execute this query.

Now I want to make the table name also variable like this

select id, first_name, last_name, city
from :customer
where id = :id

I will Pass the table name and id using HashMap. But I am getting error stating invalid sql statement?

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • 2
    SQL does not allow you to pass in identifiers as parameters. Identifiers include table names, column names, functions, database names, schema names, and operators. – Gordon Linoff Jun 09 '18 at 12:27

0 Answers0