将负整数转换为字符串 Talend open studio
我此 Talend 作业的目标是将 excel 中的数据插入 mysql 数据库。当我输入Excel文件时,Active Case的列是字符串,它包含一些负整数。
但是,我想稍后将其以整数形式存储在 mysql 数据库中。以下是Tmap中的代码。我想将所有负整数存储在数据库以及整数字段中。即使我解析为 int,这里的问题是什么。
`Var.var9==null||Var.var9==""?0:Integer.parseInt(Var.var9)`
My objective for this Talend Job is to insert the the data from excel into the mysql db. When i input the excel file, the column of Active Case is string which it contains some negative integer.
However, i want to store this as in integer later in the mysql db. The following is the code in Tmap. My want to store all the negative integers in db as well as integer field. What is the issue here even though i parse as int.
`Var.var9==null||Var.var9==""?0:Integer.parseInt(Var.var9)`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的读取输入为null或否(“”),则插入0。其他任何内容都用作数字。错误消息表明您的Excel中只有一行,其中仅包含“ - ”。您可以通过这样的尝试来轻松地复制此问题:
您将获得相同的错误消息
如果您的Excel确实不仅包含“ - ”您的分析数据中的“ - ”,那么 ,那么您应该提供更多的代码。错误可能在您的解析过程中。
If your read Input is null or nothing ("") you insert 0. Anything else is used as a number. The error message indicates that there is a row in your excel which only contains "-". You can easily reproduce this by trying it out like this:
You the get the same error message
If your excel really does not contain just a "-" in your parsed data, then you should provide more of your code. The error may be in your parsing process.