I am querying oracle database from Databricks using Scala. I am getting error while passing the variable but same code works with hard coded value. Examples are below:-
val prev_time=query_statements(PDWurl, oracle_prev_time, PDWuser, PDWpwd, oracleDriver).head.getTimestamp(0).toString().take(10)
println(prev_time)
val query=f"(select * from table where id_regn='6' and trunc(dt_last_loading)>=to_date($prev_time,'YYYY-MM-DD')) test"
But same code replacing with hardcode date value is working
val prev_time=query_statements(PDWurl, oracle_prev_time, PDWuser, PDWpwd, oracleDriver).head.getTimestamp(0).toString().take(10)
println(prev_time)
val query=f"(select * from table where id_regn='6' and trunc(dt_last_loading)>=to_date('2022-07-28','YYYY-MM-DD')) test"
What is the correct way to do it?