Hi,
I don't know why
java returns SELECT to_char(SYSDATE,'d') from dual returns 5 instead of 4 (SQL). Please help me to sort out this problem.
Thanks & Regards,
M.S.Raman
The below program return following output:
2004-09-02 11:28:48.0
5
public static void main(
String[] args) throws Exception {
String queryString1 = "SELECT SYSDATE FROM dual";
String queryString2 = "SELECT to_char(SYSDATE,'d') FROM dual";
JDBCHelper jdbcHelper = new JDBCHelper();
Connection connection = jdbcHelper.getConnection();
Statement statementObject1 = connection.createStatement();
Statement statementObject2 = connection.createStatement();
ResultSet rs1 = statementObject1.executeQuery(queryString1);
ResultSet rs2 = statementObject2.executeQuery(queryString2);
String resultString1 = null;
String resultString2 = null;
if(rs1.next())
resultString1 = rs1.getString(1);
if(rs2.next())
resultString2 = rs2.getString(1);
System.out.println(resultString1);
System.out.println(resultString2);
}