6
我正在爲python日誌記錄模塊的處理程序工作。這本質上是登錄到Oracle數據庫。當表格爲空時在cx_oracle中獲取列信息?
我正在使用cx_oracle,而我不知道如何得到的是列表值爲空時的列值。
cursor.execute('select * from FOO')
for row in cursor:
# this is never executed because cursor has no rows
print '%s\n' % row.description
# This prints none
row = cursor.fetchone()
print str(row)
row = cursor.fetchvars
# prints useful info
for each in row:
print each
輸出是:
None
<cx_Oracle.DATETIME with value [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]>
<cx_Oracle.STRING with value [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]>
現在看VAR數據,我可以看到的數據類型,以及它們的大小(計數諾內斯?),但多數民衆贊成缺少列名。
我該怎麼辦?