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

add clause RETURNING ... INTO ... to MERGE statement [CORE3020] #3401

Closed
firebird-issue-importer opened this issue May 27, 2010 · 6 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

Replaces CORE2288
Is related to QA657

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)

Commits: 9f16366 22e99e4 FirebirdSQL/fbt-repository@a1a4b7b

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 28, 2010

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 10, 2010

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 14, 2011

Modified by: @dyemanov

Link: This issue replaces CORE2288 [ CORE2288 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 6, 2014

Commented by: @pavel-zotov

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") ?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 6, 2014

Commented by: @asfernandes

RETURNING is not for INSERT only, it's used once for both.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 28, 2015

Modified by: @pcisar

Link: This issue is related to QA657 [ QA657 ]

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

2 participants