Re: [cx-oracle-users] cx_Oracle4.3.1: - describe table query is notworking!!!
Brought to you by:
atuining
From: Rob D. <Rob...@5o...> - 2007-05-09 09:54:00
|
select COLUMN_NAME,DATA_TYPE,DATA_LENGTH,NULLABLE from user_tab_columns where table_name =3D 'BOB' =20 ________________________________ From: cx-...@li... [mailto:cx-...@li...] On Behalf Of Piyush Chechani Sent: 09 May 2007 09:57 To: cx-...@li... Subject: [cx-oracle-users] cx_Oracle4.3.1: - describe table query is notworking!!! =20 Hi all...=20 Just have a look on the code below...=20 (We have 'sample database with one of the table 'tab1' & user 'demo')=20 #We are trying to fetch all the columns from the table specified & their type.=20 #This is done by using 'describe <table-name>' sql query in Oracle.=20 import cx_Oracle connection =3D cx_Oracle.Connection("demo/demo@sample") cursor =3D connection.cursor() cursor.execute("describe tab1") for row in cursor.description:=20 print "Column Name is: ",row[0]=20 print "Column Type is: ", row[1]=20 print "------------------------------------------------"=20 #But this is giving error that is: - cx_Oracle.DatabaseError: ORA-00900: invalid SQL statement=20 #I got some other method to implement this, but that is a bit lengthy. (can put that also if required)=20 #My quetion is that does cx_Oracle supports 'describe <table-name>' query or not???=20 Regards,=20 cPiyush. =3D=3D=3D=3D=3D-----=3D=3D=3D=3D=3D-----=3D=3D=3D=3D=3D Notice: The information contained in this e-mail message and/or attachments to it may contain=20 confidential or privileged information. If you are=20 not the intended recipient, any dissemination, use,=20 review, distribution, printing or copying of the=20 information contained in this e-mail message=20 and/or attachments to it are strictly prohibited. If=20 you have received this communication in error,=20 please notify us by reply e-mail or telephone and=20 immediately and permanently delete the message=20 and any attachments. Thank you =20 =20 |