【发布时间】:2021-03-11 13:47:44
【问题描述】:
我正在尝试使用这样的 Oracle 游标插入 SQL Server 来执行 executemany:
sqlservercursor.executemany("INSERT INTO tablename (col1,col2...) VALUES (?,?…)",oraclecursor)
这失败并出现错误:OverflowError: int too big to convert
我已将其诊断为大数字 (NUMBER(25)) 的 id 列。
我可以使用:
sqlservercursor.execute('INSERT INTO tablename (Id) VALUES (?)',(90100111000002885322904,))
然而这是可行的:
sqlservercursor.execute('INSERT INTO tablename (Id) VALUES (90100111000002885322904)')
有没有办法解决这个问题,或者我必须遍历光标并手动插入?与 pyodbc 的快速执行以及必须处理字符相比,这会很慢......
【问题讨论】:
-
为什么要为 SQL Server 实例使用 oracle 游标?
-
我必须将 Oracle DB 传输到 SQL Server。话虽如此,如果我相信您有一个 Decimal(38) 数字,或者我只是想使用参数添加大数字,这个问题将持续存在 SQL Server 到 SQL Server
标签: python sql-server oracle pyodbc