Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem deleting records in Oracle 9i release 2 JDBC driver with JDK 1.4

Re: Problem deleting records in Oracle 9i release 2 JDBC driver with JDK 1.4

From: Jim Kennedy <kennedy-down_with_spammers_at_no_spam.comcast.net>
Date: Tue, 16 Sep 2003 13:53:09 GMT
Message-ID: <9BE9b.84539$mp.38321@rwcrnsc51.ops.asp.att.net>


How about you do a commit after the delete? My guess is that is the problem.
Jim

"Judge" <judge321_at_hotmail.com> wrote in message news:525c7692.0309152254.46b32222_at_posting.google.com...
> 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 - 08:53:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US