开发者

ORA-01858 Oracle Date Problem while inserting from java

开发者 https://www.devze.com 2023-01-28 17:31 出处:网络
I have a code in my application which inserts java.sql.Timestamp into oracle date column. This code works fine. But occasionally i get the error :

I have a code in my application which inserts java.sql.Timestamp into oracle date column. This code works fine. But occasionally i get the error :

ORA-01858: a non-numeric character was found where a numeric was expected. 

When i see the log, similar inserts executed at the same time are successful and then all of a sudden one particular operation fails. When i look at the format between different statements, they are similar. Could not guess the problem.

The first statement failed. But the second has got inserted successfully.

INSERT INTO OMTM_EXECUTE_REPORT(er_id_pk,er_oms_order_id,er_orig_oms_order_id,er_esis_no,er_transaction_no,er_exec_trans_type,er_exec_type,er_ord_status,er_order_rej_reason,er_cust_account,er_settle_type,er_fut_settle_dt,er_security_type,er_symbol_code,er_action,er_ord_quantity,er_ord_type,er_price_per_share,er_stop_price_per_share,er_currency_id,er_time_in_force,er_expire_time,er_last_trd_shares,er_traded_price_per_share,er_leaves_quantity,er_cumulative_qty,er_average_price,er_transact_time,er_trade_date,er_text,er_can_rej_response_to,er_can_rej_reason,er_disclosed_quantity,er_fill_quantity,er_read_flag,er_settle_flag,er_exec_rep_time,er_modified_datetime)
      VALUES      (OMSQ_TM_ID_PK.NEXTVAL,5168,0,08434308,0436594708434308,0,2,2,null,0079027076,9,null,null,ALDAR,BUY,100000,2,5.33,0.0,0,0,2009-12-17 00:00:00.0,100000,5.33,0,100000,5.33,2009-12-17 06:01:54.0,2009-12-17 06:01:54.0,Hold Created Inspite of Insufficient Bal,null,null,0,0,'N','N',SYSDATE,SYSDATE)


INSERT INTO OMTM_EXECUTE_REPORT(er_id_pk,er_oms_order_id,er_orig_oms_order_id,er_esis_no,er开发者_C百科_transaction_no,er_exec_trans_type,er_exec_type,er_ord_status,er_order_rej_reason,er_cust_account,er_settle_type,er_fut_settle_dt,er_security_type,er_symbol_code,er_action,er_ord_quantity,er_ord_type,er_price_per_share,er_stop_price_per_share,er_currency_id,er_time_in_force,er_expire_time,er_last_trd_shares,er_traded_price_per_share,er_leaves_quantity,er_cumulative_qty,er_average_price,er_transact_time,er_trade_date,er_text,er_can_rej_response_to,er_can_rej_reason,er_disclosed_quantity,er_fill_quantity,er_read_flag,er_settle_flag,er_exec_rep_time,er_modified_datetime)       
VALUES      (OMSQ_TM_ID_PK.NEXTVAL,5170,0,08434400,0436599708434400,0,2,2,null,0059729784,9,null,null,SOROUH,SELL,82574,2,2.83,0.0,0,0,2009-12-17 00:00:00.0,82574,2.83,0,82574,2.83,2009-12-17 06:04:48.0,2009-12-17 06:04:48.0,null,null,null,0,0,'N', 'N',SYSDATE,SYSDATE)

Any help would be highly appreciated

Thanks


2009-12-17 06:01:54.0 is not a valid timestamp literal for Oracle

You need to use: TIMESTAMP '2009-12-17 06:01:54.0'

Although it's surprising that one of those statements actually works


From what you said, two possibilities come to my mind:

  • You have a concurrency problem. Are you using a shared prepared statement, or a shared connection, accessed by multiple threads concurrently?
  • You found a bug in the Oracle JDBC driver... did you try updating to the newest version?
0

精彩评论

暂无评论...
验证码 换一张
取 消