|
用 cx_Oracle
地址: http://cx-oracle.sourceforge.net/
选合适的python版本 + oracle版本下载
文档里面的简单的例子
{{{
import cx_Oracle
# connect via SQL*Net string or by each segment in a separate argument
#connection = cx_Oracle.connect("user/password@TNS")
connection = cx_Oracle.connect("user", "password", "TNS")
cursor = connection.cursor()
cursor.execute("""
select Col1, Col2, Col3
from SomeTable
where Col4 = :arg_1
and Col5 between :arg_2 and :arg_3""",
arg_1 = "VALUE",
arg_2 = 5,
arg_3 = 15)
for column_1, column_2, column_3 in cursor:
print "Values:", column_1, column_2, column_3
}}} |
|