oracle/python-cx_Oracle (original) (raw)

See https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html for how to report security issues.

For other issues:

  1. Is it an error or a hang or a crash?

It is an error

  1. What error(s) you are seeing?

cx_Oracle.DatabaseError: DPI-1044: value cannot be represented as an Oracle number

  1. Include a runnable Python script that shows the problem.
    Include all SQL needed to create the database schema.
create table test(
    id number default to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'), 
    txt varchar2(20) );

insert into test(txt) values('test');
commit;

import cx_Oracle

oracle_con = cx_Oracle.connect("...", "...", "<...DSN description..>", encoding="UTF-8")
cursor = oracle_con.cursor() 
cursor.execute("select id from test where txt = 'test'") 
res=cursor.fetchone()
cursor.execute("select * from test where id = :id",id=res[0])
# this works: cursor.execute("select * from test where id = " + str(res[0]))
cursor.close()
oracle_con.close()
  1. Show the output of:
import sys
import platform

print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())

platform.platform: Linux-3.10.0-1127.el7.x86_64-x86_64-with-redhat-7.8-Maipo
sys.maxsize > 2**32: True
platform.python_version: 3.6.8

And:

import cx_Oracle
print("cx_Oracle.version:", cx_Oracle.version)
print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
cx_Oracle.version: 7.3.0
cx_Oracle.clientversion: (19, 6, 0, 0, 0)
  1. What is your Oracle Database version?

12.1.0.2