Re: [cx-oracle-users] More than one type returned for a single column
Brought to you by:
atuining
From: Chris G. <chr...@to...> - 2012-09-30 00:13:00
|
Arent they really both type NUMBER ? On Sunday, September 30, 2012, Anssi Kääriäinen wrote: > It seems it is possible to have more than one type returned for a single > column. Observe this test case: > > import cx_Oracle > print cx_Oracle.version > connection = cx_Oracle.connect('user/ > passwd@' + cx_Oracle.makedsn('localhost', 1521, 'xe')) > cur = connection.cursor() > cur.execute("select case when dbms_random.random > 0.5 then 0.1 else 0 end > from testtable") > vals = [] > vals.extend(row[0] for row in cur.fetchall()) > print set([type(v) for v in vals]) > > The output is: > 5.1.2 > set([<type 'float'>, <type 'int'>]) > > To me this seems surprising - shouldn't a column have the same type across > all rows in a single resultset? > > - Anssi > -- Sent from Gmail Mobile |