You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
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") ?
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
The text was updated successfully, but these errors were encountered: