我有一张excel表select A.TN, A.START_DATE, A.OPERATOR, NVL(A.expiration_date,
to_date('31-12- 9999 00:00:00','DD-MM-YYYY hh24:mi:ss'))
from
(select tn,start_date,destination,
Lead(effective_date) over (partition by tn order by effective_date ) as expiration_date
from
(select op.DEST_ID tn, op.EFFECTIVE_DATE start_date,
op.PROVIDER_ID destination
from Output_Data op, Input_Data ip where op.DEST_ID=ip.TN
union
select ip.TN tn, ip.start_date effective_date, ip.operator destination
from Input_Data ip) T) A
where effective_date != NVL(expiration_date,to_date('31-12-9999','DD-MM-YYYY hh24:mi:ss'))
,如下所示:
Book.xls
我正在尝试将日期从excel插入MySQL表格,如下所示:
_________________________________________________________________
| | |
| INVOICE | INVOICE_DATE |
|_________________________________________|______________________|
| | |
|C-EDGE/SBI//BHO/(ATM)-013/2012–2013 | 11-Feb-2013 |
|_________________________________________|______________________|
|C-EDGE/SBI//BANG/(ATM)-013/2012–2013 | 13-Aug-2014 |
|_________________________________________|______________________|
然而,我有一个例外:
“com.mysql.jdbc.MysqlDataTruncation:数据截断: 日期时间值不正确:'Mon Feb 11 00:00:00 IST 2013'for 第1行“INVOICE_DATE”列。
这是如何引起的?如何解决?
答案 0 :(得分:1)
使用PreparedStatement
时,请使用?
占位符作为值;然后您可以使用setDate
的{{1}}方法。例如。在你的代码中:
PreparedStatemet
参见例如http://tutorials.jenkov.com/jdbc/preparedstatement.html了解更多信息。