Issue Details (XML | Word | Printable)

Key: CORE-3020
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Pavel Zotov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

add clause RETURNING ... INTO ... to MERGE statement

Created: 27/May/10 02:54 PM   Updated: 28/Sep/15 01:53 PM
Component/s: None
Affects Version/s: 2.5 RC2
Fix Version/s: 3.0 Alpha 1

Issue Links:
Relate
 
Replace
 


 Description  « Hide
It will be nice if we can do something like this:

  merge into fbl_row t
  using (select :vdid vdid, :vpid vpid, :vqty vqty, :vcost vcost from rdb$database ) s
  on (t.did=s.vdid and t.pid=s.vpid)
  when matched then
      update set pqty = pqty + s.vqty, rcnt = rcnt+1
  when NOT matched then insert (id, did, pid, pqty, pcost)
      values(gen_id(gen_test2,1), s.vdid, s.vpid, s.vqty, s.vcost);
  returning id
  into :vrow;

As far as I understand current version of FB does not support it ? (http://firebirdsql.org/rlsnotesh/rlsnotes210.html#rnfb210-merge)

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adriano dos Santos Fernandes made changes - 27/May/10 10:49 PM
Field Original Value New Value
Assignee Adriano dos Santos Fernandes [ asfernandes ]
Adriano dos Santos Fernandes made changes - 10/Jun/10 02:05 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 Alpha 1 [ 10331 ]
Resolution Fixed [ 1 ]
Dmitry Yemanov made changes - 14/Feb/11 11:22 AM
Link This issue replaces CORE-2288 [ CORE-2288 ]
Pavel Zotov added a comment - 06/Mar/14 12:04 PM - edited
Adriano,

is it possible to add RETURNING clause not only to INSERT statement (i.e in the "when NOT matched" branch) but also to UPDATE one (into "when MATCHED") ?

Adriano dos Santos Fernandes added a comment - 06/Mar/14 12:08 PM
RETURNING is not for INSERT only, it's used once for both.

Pavel Cisar made changes - 28/Sep/15 01:53 PM
Link This issue is related to QA-657 [ QA-657 ]