1 year ago
#384215
Ro Ma
The possible "cx_Oracle.DatabaseError: ORA-01722: invalid number" reason of retrieve data from oracle by cx_oracle
I have one basic SQL :
select * from my_schema.table
when I run this in Dbeaver, can return data without problem, but when I use python cx_Oracle, will runs into
cx_Oracle.DatabaseError: ORA-01722: invalid number
import pandas as pd
import cx_Oracle
import sqlalchemy
con_str = f'oracle://{user}:{passwd}@{dsn}'
conn = sqlalchemy.create_engine(con_str)
aa = pd.read_sql_query('''SELECT * FROM my_schema.table''', conn)
from my understanding, there is no string convert operation which is the reason of the ORA-01722
I even use ojdbc in R, also result is ORA-01722
I use same method read other table, without any issue.
If I limit the result in to 1 or 2 lines(add 'where rownum < 2'), the data is normal, that means the problem data is in row 2 ??.
I checked the data, all normal, this table are generated by other table in same server.
Where should I start to debug the issue? pls anyone give me any hint.
I know I should paste the data to regenerate the issue, but the data is confidential, so I can't, sorry for that.
run out of idea.
python
oracle
cx-oracle
0 Answers
Your Answer