I connected Python to Oracle.
I am trying to display the attributes of the table using python i.e
I want to display table schema. I am using ‘describe’ statement but while executing it gives me an error ' Invalid SQL Statement'.
I have done the following:
queryString = 'Describe Customer' onCursor.execute(queryString)
“Customer” is the table name
Advertisement
Answer
In below sql you replace the table and owner name. It gives the columns names and datatype of column.
SELECT COLUMN_NAME, DATA_TYPE FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='table_name' and OWNER='schema name'