Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-row UPDATE and DELETE RETURNING for Oracle using PL/SQL RETURNING .. BULK COLLECT INTO #5191

Closed
lukaseder opened this issue Apr 5, 2016 · 0 comments

Comments

@lukaseder
Copy link
Member

lukaseder commented Apr 5, 2016

In addition to single RETURNING clauses, it would be also very useful to support UPDATE and DELETE .. RETURNING for multi-row DML statements. This is possible with PL/SQL

UPDATE t SET x = 1 WHERE 1 = 1 RETURNING y BULK COLLECT INTO ?;

Or more specifically:

declare
  t0 dbms_sql.number_table;
  t1 dbms_sql.date_table;
  c0 sys_refcursor;
  c1 sys_refcursor;
begin
  update "TEST"."T_2155"
  set "TEST"."T_2155"."D1" = date '2003-03-03'
  returning 
    "TEST"."T_2155"."ID", 
    "TEST"."T_2155"."D1"
  bulk collect into t0, t1;
  ? := sql%rowcount;
  open c0 for select * from table(t0);
  open c1 for select * from table(t1);
  ? := c0;
  ? := c1;
end;

The difficulty is to have nominal TABLE types that must be generated ad-hoc for this query prior to executing the query.

An alternative is to use the PL/SQL TABLE types from DBMS_SQL to serialise the individual columns through individual SYS_REFCURSOR result values.


See also: #5190

@lukaseder lukaseder added this to the Version 3.9.0 milestone Apr 5, 2016
@lukaseder lukaseder changed the title Emulate multi-row UPDATE and DELETE RETURNING for Oracle using PL/SQL RETURNING .. BULK COLLECT INTO Support multi-row UPDATE and DELETE RETURNING for Oracle using PL/SQL RETURNING .. BULK COLLECT INTO Apr 5, 2016
lukaseder added a commit that referenced this issue Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant