Inserted newest record:- Trading_Date/Trading_Time: 2016-1-11, 12 Oldest record:- Trading_Date/Trading_Time: 2012-02-06, 6 Deleted oldest record Adding a new trade record Number: 4101
----- SQLException ----- SQL State: 23505 Error Code: 20000 Message: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL170412104646890' defined on 'TRADES'. The above occurs after the program is part way through its second run(it runs every six hours) At this stage, a new trade record is required to be added (since a trade was opened and closed on the first run The new trade number is correctly stated as 4101 At this stage the trade table has 4,100 records so why the error message regarding duplicate keys ????? I don't get it ! The key is the trade number Bob M -- View this message in context: http://apache-database.10148.n7.nabble.com/Updating-2-derby-tables-tp147386p147411.html Sent from the Apache Derby Users mailing list archive at Nabble.com.