windows - python中通过cx_Oracle查询表中字段报错,不能用desc tablename吗?请大神赐教啊!
PHPz
PHPz 2017-04-18 10:02:10
0
1
358
#连接数据库
db_conn = cx_Oracle.connect(db_connect_info)
cursor = db_conn.cursor()

get_base_table_stru = "desc  " + db_base_table
cursor.execute(get_base_table_stru)

db_base_table_content = cursor.fetchall()
for row in db_base_table_content:
    print row

报错:Traceback (most recent call last):
File "C:\Users\victor\Desktop\Ӣ��\DDLDML\ddldml\src\generate_ddl_dml.py", line 107, in <module>

cursor.execute(get_base_table_stru)

cx_Oracle.DatabaseError: ORA-00900: ��Ч SQL ���

PHPz
PHPz

学习是最好的投资!

reply all(1)
巴扎黑

desc is a command in sqlplus, not a legal sql statement, so an ORA-00900 error occurred.
If you want to query table information, please query the user_tables table.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template