Re: [cx-oracle-users] Check Col Type
Brought to you by:
atuining
From: Mark H. <mh...@pi...> - 2010-06-08 21:44:33
|
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)] HTH! Mark |