oracle / oracle-r2dbc

R2DBC Driver for Oracle Database
https://oracle.com
Other
194 stars 40 forks source link

Question: DELETE command with RETURNING INTO #69

Closed jenoforizs closed 1 year ago

jenoforizs commented 2 years ago

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;"

Michael-A-McMahon commented 2 years ago

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.

Michael-A-McMahon commented 2 years ago

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.

jenoforizs commented 2 years ago

Michael, thank you for the reply, I really appreciate it. I'm going to check if I can use this solution.

Michael-A-McMahon commented 1 year ago

Hope things worked out. Please create a new issue if there's anything we need to add in Oracle R2DBC.