pythonoracle-databasecx-oracleexecutemany

Python cx_Oracle executemany() how many rows inserted into DB


I use cx_oracle executemany function to insert data into a table in Oracle. I would like to check after commit the action what is the actual amount of records append to the table. can it be done and how? Thanks


Solution

  • If you are using a cursor with the executemany method, then use the cursor's rowcount attribute to retrieve the number of rows affected by executemany.

    There are many nuances associated with the Cursor objects executmany method fro SELECT and DML statements. Take a look at the cx_Oracle documentation for details at https://cx-oracle.readthedocs.io/en/latest/user_guide/batch_statement.html#batchstmnt

    It may be helpful if you could post a code snippet of what is being attempted to elicit a more accurate response.