使用 jython 将数字插入到 oracle sql 中

发布于 2024-08-26 18:09:22 字数 494 浏览 1 评论 0原文

中获取的数字,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

优雅的叶子 2024-09-02 18:09:22

我没有 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 a TAB into the string and not the number 9, 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文