Re: [cx-oracle-users] Check Col Type
Brought to you by:
atuining
From: Robert <web...@gm...> - 2010-06-08 22:22:06
|
thanks I meant from within Python, I have called "curs.description" but the type is a type object and I wonder how tyo get the string value of the type On Tue, Jun 8, 2010 at 5:10 PM, Mark Harrison <mh...@pi...> wrote: > On 6/8/10 2:03 PM, Robert wrote: >> hi what's the "proper" way to check when column is NUMBER or STRING ? > > you can look in the data dictionary: > > select data_type from user_tab_cols where table_name='FOO' and column_name='BAR' > > > > or if you have just executed a query, look at the cursor.description: > > >>> curs.execute("select 99,'asdf' from dual") > <__builtin__.OracleCursor on <cx_Oracle.Connection to mh@templar>> > >>> curs.description > [('99', <type 'cx_Oracle.NUMBER'>, 127, 22, 0, 0, 1), ("'ASDF'", <type 'cx_Oracle.FIXED_CHAR'>, 32, 32, 0, 0, 1)] > > |