我想通过使用python查询Oracle数据库被Python
查询数据库这是我的代码:
import cx_Oracle
import os
def GetDatabase(queryCommand, row):
conn = cx_Oracle.connect('Bell/Bell#@nn.nnn.nnn.nn:1521/Bell')
cur = conn.cursor()
cur.execute(queryCommand)
res=cur.fetchone()
i = 0
while (i < row):
if cur.rowcount == row:
print res
res=cur.fetchone()
i = i + 1
cur.close()
conn.close()
tup1=GetDatabase("select Name from ContactPoint where EmployeeID='1234'",2)
这是输出
('KANOK BKK',)
我只想值(我不想括号和逗号)
我尝试打印tup1 [0]但它不工作。
包含实际IP地址可能不是一个好主意。 – APC