querying a view in oracle using java code with a where condition on a date field -


i need connect view in oracle view contains information matrix population in other tables. structure of view (v_matrix) is: period_start_time not null date, matrix_table varchar2(20), matrix_name varchar2(20), completion_time date

i using java code using jdbc connect view.

the query have is:

string query = "select * v_matrix period_start_time \'2016-04-18 17:%\' , matrix_table = \'" + tablename + "\'  , matrix_name in (" + inclausestr.tostring() + ")"; 

the problem query fetches nothing while can see around 200 records in view period_start_time in order of 17th hour on 18th april 2016. same query works fine in sql developer

i tried googling bud not find tutorial on how filter records on date field using java code.

i tried changing query to

string query = "select * v_kpi_availability to_char(period_start_time,\'yyyy-mm-dd hh24:mi:ss\') \'2016-04-18 17:%\' , kpi_table = \'" + tablename + "\'  , kpi_name in (" + inclausestr.tostring() + ")"; 

but query still not fetch records ps: database oracle 11g (11.2.0.4)

surprising code works in pre-prod environment following query:

string query = "select * v_kpi_availability to_char(period_start_time,\'yyyy-mm-dd hh24:mi:ss\') \'2016-04-18 17:%\' , kpi_table = \'" + tablename + "\'  , kpi_name in (" + inclausestr.tostring() + ")"; 

the reason not working in lab because lab on oracle 10g implementation of date bit different.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -