Resultset is empty while executing trunc(sysdate) from Java/Jdbc -


i facing issue using trunc(sysdate) oracle run query jdbc. able connect database code , execute simple queries testing purposes. below queries tried , and both seem return nothing.

  //string sql ="select code testtable to_char(process_dt,'mm/dd/yyyy') = (select to_char(sysdate,'mm/dd/yyyy') dual)";      string sql ="select process_dt,code testtable  process_dt = trunc(sysdate)";          //creating preparedstatement object execute query         preparedstatement prestatement = connection.preparestatement(sql);          resultset result = prestatement.executequery();           while(result.next()){            string code = result.getstring("code");            system.out.println("---- code ----" + code);         } 

the query above not return rows database when run jdbc code java. same runs in pl/sql developer , returns me matched rows testtable.

edit : updated

==============================

        process_dt , code          11/21/2013    nfs          11/22/2013    nfs          03/10/2014    vps 

the datatype of process_dt date in db , want compare current business/sysdate code.

can let me know problem , doing wrong above , ways correct it. great not find on net issue.

thanks vikeng21

i think problem want run trunc on both ends of date check. this:

string sql ="select code testtable  trunc(process_dt) = trunc(sysdate)"; 

otherwise query return when process_dt matches trunc(sysdate). possibility code connecting different database sqldeveloper.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -