1.Python连接oracle数据库,想在WEB界面以表的形式展开,但查询出来的列名与原本表中的顺序完全不匹配,不能与查询的数据拼接,请各位大神指点一下
2.` oracle = cx_Oracle.connect('。。。' % )
cursor = oracle.cursor()
#查询所有列名
columnsname = cursor.execute(
"select COLUMN_NAME from user_tab_columns where TABLE_NAME='test'").fetchall()
#查询数据
infos = cursor.execute('select * from %s' % table).fetchall() `
3.
columnsname = [tuple[0] for tuple in cursor.description]
这样迭代出来的列名就可以匹配导出的数据了