MERGE
INTO
ACRESCGRY acresgry
USING
(
SELECT ACRESCGRY_ID, RESCLASSNAME FROM (
SELECT (SELECT MAX(ACRESCGRY_ID)+1 FROM acrescgry) ACRESCGRY_ID, 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd' RESCLASSNAME FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresgry.RESCLASSNAME = t.RESCLASSNAME
)
WHEN MATCHED THEN
UPDATE SET
acresgry.RESCLASSNAME = t.RESCLASSNAME
WHEN NOT MATCHED THEN
INSERT (acresgry.ACRESCGRY_ID, acresgry.RESCLASSNAME)
VALUES (t.ACRESCGRY_ID, t.RESCLASSNAME)
;
MERGE
INTO
ACRESACT acresact
USING
(
SELECT ACRESCGRY_ID, ACACTION_ID FROM (
SELECT (SELECT ACRESCGRY_ID FROM acrescgry where RESCLASSNAME like 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd') ACRESCGRY_ID, (SELECT ACACTION_ID FROM acaction where action = 'Execute') ACACTION_ID FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresact.ACRESCGRY_ID = t.ACRESCGRY_ID and acresact.ACACTION_ID = t.ACACTION_ID
)
WHEN NOT MATCHED THEN
INSERT (acresact.ACRESCGRY_ID, acresact.ACACTION_ID)
VALUES (t.ACRESCGRY_ID, t.ACACTION_ID)
;
MERGE
INTO
ACRESGPRES acresgpres
USING
(
SELECT ACRESGRP_ID, ACRESCGRY_ID FROM (
SELECT (SELECT ACRESGRP_ID FROM ACRESGRP where GRPNAME = 'RegisteredUserCmdResourceGroup') ACRESGRP_ID , (SELECT ACRESCGRY_ID FROM acrescgry where RESCLASSNAME like 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd') ACRESCGRY_ID FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresgpres.ACRESGRP_ID = t.ACRESGRP_ID and acresgpres.ACRESCGRY_ID = t.ACRESCGRY_ID
)
WHEN NOT MATCHED THEN
INSERT (acresgpres.ACRESGRP_ID , acresgpres.ACRESCGRY_ID)
VALUES (t.ACRESGRP_ID, t.ACRESCGRY_ID )
;