I am facing two issues which I believe may be related.
I am trying to execute a JDBC select against oracle (10g) database and result set shows the date column as a timestamp
ResultSetMetaData rsMetaData = null;
rsMetaData = resultSet.getMetaData();
if(rsMetaData.getColumnType(1) == java.sql.Types.TIMESTAMP){
System.out.println("Timestamp");
}
The datatype for this column in oracle is DATE so I would exptect columnType returned by resultSetMeta
to be DATE but it is always TIMESTAMP
.
After processing this data I am trying to load the same to Oracle database using sqlldr Because of the wrong data type recevied in the input the output control file uses TIMESTAMP. (This control file is created by my program based on the resultSetMetaData.) Here is exactly how it appears in the control file.
TIMESTAMP "yyyy-MM-dd HH24:mi:ss.ff"
The problem starts when I try to load the following data using this control file.
1987-06-17 00:00:00.0
The sqlldr successfully loads this data into Oracle without any warnings, but when I check the target table I get the date as '16-Jun-1987' instead of the expected/required '17-Jun-1987'. This may be because of the way the time "00:00:00.0" is interpreted by oracle.
Both of the problems 1 and 2 above are serious issues for me and I could not find an explanation.