oracle-r2dbc
oracle-r2dbc copied to clipboard
Question: DELETE command with RETURNING INTO
Quote from the readme: "Returning generated values is only supported for INSERT and UPDATE commands when a RETURNING INTO clause can be appended to the end of that command."
Is there any plan for implementing this feature for DELETE commands? To support such statement: "DELETE cars RETURNING listagg(distinct cars.registration_number, ',') INTO :registration_numbers;"
Oracle R2DBC relies on the underlying Oracle JDBC driver to return generated values/keys, and Oracle JDBC only supports this for INSERT/UPDATE, not for DELETE. Currently, there's no plan to add support for DELETE.
However, it may be possible to return deleted values by registering an out parameter. Have you tried this approach?
I'm on break this week, but I might have some time to test it out on my own next week.
Not quite a code example, but I do have test code that binds an out parameter with RETURNING INTO: https://github.com/oracle/oracle-r2dbc/blob/068cf0f4268d4d11789932eed1651010b0456327/src/test/java/oracle/r2dbc/impl/OracleStatementImplTest.java#L1454
The test code is executing an INSERT, but it I think it will be possible to do something similar for a DELETE.
Michael, thank you for the reply, I really appreciate it. I'm going to check if I can use this solution.
Hope things worked out. Please create a new issue if there's anything we need to add in Oracle R2DBC.