The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

Python cx_Oracle 6.3 Supports DML RETURNING for Batch Statement Execution

Christopher Jones
Senior Principal Product Manager

cx_Oracle logo

cx_Oracle 6.3, the extremely popular Oracle Database interface for Python, is now Production on PyPI.

cx_Oracle is an open source package that covers the Python Database API specification with many additions to support Oracle advanced features.

Top Feature: Cursor.executemany() support for OUT bind variables in DML RETURNING statements.


This release contains a number of bug fixes and useful improvements. For the full list, see the Release Notes, but I wanted to highlight a few features:

  • Support for binding integers and floats as cx_Oracle.NATIVE_FLOAT.

  • Support for true heterogeneous session pools that use different username/password combinations for each session acquired from the pool.

  • All cx_Oracle exceptions raised by cx_Oracle now produce a cx_Oracle._Error object.

  • Support for getting the OUT values of bind variables bound to a DML RETURNING statement when calling Cursor.executemany(). For technical reasons, this requires setting a new attribute in cx_Oracle.__future__. As an example:

    cx_Oracle.__future__.dml_ret_array_val = True
    data = [[10], [20], [30]]
    childIdVar = cursor.var(int, arraysize = len(data))
    cursor.setinputsizes(None, childIdVar)
            delete from ChildTable
            where ParentId = :1
            returning ChildId into :2""", data)
    for ix, inputRow in enumerate(data):
        print("Child ids deleted for parent id", inputRow[0], "are",

    Want to know what this displays? Stay tuned to this blog site for an upcoming post on using executemany() in cx_Oracle!

cx_Oracle References

Home page: oracle.github.io/python-cx_Oracle/index.html

Installation instructions: cx-oracle.readthedocs.io/en/latest/installation.html

Documentation: cx-oracle.readthedocs.io/en/latest/index.html

Release Notes: cx-oracle.readthedocs.io/en/latest/releasenotes.html

Source Code Repository: github.com/oracle/python-cx_Oracle

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.