次の表があります。
create table companies (id identity, version int not null, last_modified timestamp not null);
insert into companies (version, last_modified) values (0, NOW());
次に、 を作成し、PreparedStatementインデックス 1 の値を指定します。
merge into companies (id, version, last_modified) values(?, version + 1, NOW())
H2 は次のエラーで失敗します。
Column "VERSION" not found
version + 1H2 が右側を好まないことは理解していますが、新しい行とversion + 1既存の行に対して 0 を返す方法が明確ではありません。selectでステートメントを使用するよりも簡単な方法はありunionますか?