I don't know if it works this way with Oracle, but the python dbpai has the cursor.description method that can help. For example:
cur.execute( "your query here" ) columns = [i[0] for i in cur.description] cur.description gives a lot of data about your recordset, and the first field is the column name. Hope this helps... Luis A.M wrote: > Hi > > > > I use a code similar to this to retrieve data from Oracle database: > > > > import cx_Oracle > > > > con = cx_Oracle.connect("me/[EMAIL PROTECTED]") > > cur = con.cursor() > > outcur = con.cursor() > > cur.execute(""" > > BEGIN > > MyPkg.MyProc(:cur); > > END;""", cur=outcur) > > > > for row in out_cur: > > print row > > > > > > The problem is I don't know how to find out what are the column name and > type that comes out of query (each row in cursor). > > > > Is there any possibility that my Python code can find out the column name > and type in each row in cursor? > > > > The other problem is accessing data in each row by column name. In Ruby I > can say: > > > > Print row["ColName"] > > > > In Python; however, I must access to row contents by integer index, like > PRINT ROW[0], which reduces my program's readability. > > > > Can I access to row's contents by column name? > > > > Any help would be appreciated, > > Alan -- http://mail.python.org/mailman/listinfo/python-list