使用 jython 将数字插入到 oracle sql 中
中获取的数字,
i=0
for line in column:
myStmt.executeQuery("INSERT INTO REVERSE_COL
( TABLE_NAME,COL_NAME,POS) values
(,'test','"+column[i]+"','"+i+"'")
i=i+1
我有这个插入命令,其中 iam 试图插入一个从循环POS IS NUMBER DATATYPE
但如果我将其硬编码为 1 ,它会起作用
i=0
for line in column:
myStmt.executeQuery("INSERT INTO REVERSE_COL
( TABLE_NAME,COL_NAME,POS) values
(,'test','"+column[i]+"',1")
我只尝试了 i 、 +i+ 和其他方法,但它没有任何建议如何解决这 。
谢谢大家。
I have this insert command where iam trying to insert a number to be taken from loop
i=0
for line in column:
myStmt.executeQuery("INSERT INTO REVERSE_COL
( TABLE_NAME,COL_NAME,POS) values
(,'test','"+column[i]+"','"+i+"'")
i=i+1
POS IS NUMBER DATATYPE
but it works if i hard code as 1
i=0
for line in column:
myStmt.executeQuery("INSERT INTO REVERSE_COL
( TABLE_NAME,COL_NAME,POS) values
(,'test','"+column[i]+"',1")
I have tried only i , +i+ and other method but its not working any suggestion how to solve this .
Thanks everyone .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有 jython 经验,但我仍然会尝试提供我个人的方法和建议。从中获取你想要的东西。
我要研究的第一件事(也许这是其他人立即知道的事情)是数字与字符串连接的方式。我在这里是从 C++ 背景来讲的,但是数字
i
很可能会转换为表示该值的 ASCII 字符,而不一定是您想要的字符。例如,如果
i
为 9,则可能会将TAB
放入字符串中,而不是数字9
,后者是一个 ASCII 值57.再说一次,我并不是告诉你这就是答案……但这是我脑海中首先浮现的事情。祝你好运!
I have no jython experience, but I will still try to offer my personal approach and advice. Take from it what you will.
The first thing that I would look into, and perhaps this is something someone else knows offhand, is the way that a number is concatenated to the string. I'm speaking from a C++ background here, but a number
i
may well be converted to the ASCII character representing that value, and not necessarily the character that you intend.For example, if
i
is 9, it may be placing aTAB
into the string and not the number9
, which would be an ASCII value 57.Again, I'm not telling you this IS the answer...but it's the first thing that pops into my mind. Good luck!