【发布时间】:2013-05-29 02:18:20
【问题描述】:
我在让 PyODBC 与 Oracle 中的 proc 一起工作时遇到了一些麻烦。
下面是代码和输出
db = pyodbc.connect('DSN=TEST;UID=cantsay;PWD=cantsay')
print('-' * 20)
try:
c = db.cursor()
rs = c.execute("select * from v$version where banner like 'Oracle%'")
for txt in c.fetchall():
print('%s' % (txt[0]))
test = ""
row = c.execute("call DKB_test.TESTPROC('7894','789465','789465')").fetchall()
finally:
db.close()
输出
> C:\Documents and Settings\dex\Desktop>orctest.py
> -------------------- Oracle Database 10g Release 10.2.0.4.0 - 64bit Production Traceback (most recent call last): File "C:\Documents and
> Settings\dex\Desktop\orctest.py", line 31, in <module>
> row = c.execute("{call DKB_test.TESTPROC(12354,78946,123 4)}").fetchall()
> pyodbc.Error: ('HY000', "[HY000] [Oracle][ODBC][Ora]ORA-06550: line 1,
> column 7: \nPLS-00221: 'TESTPROC' is not a procedure
> or is undefined\nORA- 06550: line 1, column 7:\nPL/SQL: Statement
> ignored\n (6550) (SQLExecDirectW)")
但是我可以看到这个过程并用 c# 编码它可以工作,但是我正在做的这个项目现在需要 python。
我在 Google 上进行了一些搜索,但没有任何结果对我有帮助。
任何事情都将不胜感激。
【问题讨论】: