Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Problem deleting records in Oracle 9i release 2 JDBC driver with JDK 1.4
Hi gurus,
I have a problem deleting records. I am using JDBC thin driver for
Oracle 9i release 2 with JDK 1.4.
I have the following Table:
RESOURCE_ID CHANGE_INDICATOR TIME_STAMP
------------ ---------------- ------------ M_CYCLE_5 0 16-SEP-03 39.52.429000 AM M_CYCLE_3 0 16-SEP-03 39.52.429000 AM M_CYCLE_0 0 16-SEP-03 11.39.52.439000 AM
I would like to delete all the records which are older than 1 minute.
I do that by following SQL statement:
DELETE FROM deleted WHERE (SYSTIMESTAMP-time_stamp) > INTERVAL '60'
SECOND AND change_indicator <=0
If I execute that SQL statment from the SQLPlus the above records will be deleted.
However if I do that from my java program it does not delete anything. Is that a bug. If it is a bug, is there any work around for that.
Below is my java method tries to do the same thing.
public int delete(int seconds)
throws SQLException
{
int count = 0;
String sql = "DELETE FROM "
+ tableName_
+ " WHERE (SYSTIMESTAMP-time_stamp) > INTERVAL "
+ "\'"
+ seconds
+ "\' SECOND "
+ "AND change_indicator <= 0";
System.out.println(sql);
count = conn_.prepareStatement(sql).executeUpdate();
System.out.println("no of deleted data deleted = " + count);
return count;
}
thanks in advance,
Soe
Received on Tue Sep 16 2003 - 01:54:10 CDT