You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If i try to fetch data with the datatype number(5,2) i got error:
File "C:\Program Files (x86)\Python37-32\lib\site-packages\pypyodbc.py", line 608, in Decimal_cvt
return Decimal(x)
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
This error happens only if the value has decimals, for example 1.23,
if the value has no decimals like 1.00 there is no error.
Database is oracle 12 (dont know if other databases produce this error too)
Reproducable with
def foo():
sql = """
select cast(1.23 as number(5,2))
from dual;
"""
cs = "Driver={Oracle in OraClient12Home1_32bit};Dbq=xxx;Uid=xxx;Pwd=xxx;app=pypyodbc"
conn = pypyodbc.connect(cs)
cur = conn.cursor()
cur.execute(sql)
d = cur.fetchall()
Tried to workaround with cast(1.23 as float) but it brings error to if the value has decimals:
File "C:\Program Files (x86)\Python37-32\lib\site-packages\pypyodbc.py", line 1911, in fetchone
value_list.append(buf_cvt_func(alloc_buffer.value))
ValueError: could not convert string to float: b'1,23'
I have no usable workaround.
The text was updated successfully, but these errors were encountered:
I take a closer look at the code, and if iam right the Decimal_cvt uses Lib/decimal.py,
so i guess the problem comes from different decimal separators . or ,
If the database uses and delivers , has separator pypyodbc fails to convert cause other separators than . not usable!?
If i try to fetch data with the datatype number(5,2) i got error:
This error happens only if the value has decimals, for example 1.23,
if the value has no decimals like 1.00 there is no error.
Database is oracle 12 (dont know if other databases produce this error too)
Reproducable with
Tried to workaround with cast(1.23 as float) but it brings error to if the value has decimals:
I have no usable workaround.
The text was updated successfully, but these errors were encountered: