CREATE TABLE UM_HYBRID_GROUP_ROLE(
UM_ID DECIMAL(31,0) NOT NULL,
UM_GROUP_NAME VARCHAR(255) NOT NULL,
UM_ROLE_ID DECIMAL(31,0) NOT NULL,
UM_TENANT_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
UM_DOMAIN_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
UNIQUE(UM_GROUP_NAME,UM_ROLE_ID,UM_TENANT_ID),
FOREIGN KEY(UM_ROLE_ID,UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY(UM_ID,UM_TENANT_ID)
)/

CREATE SEQUENCE UM_HYBRID_GROUP_ROLE_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
NO CACHE/

CREATE TRIGGER UM_HYBRID_GROUP_RO1 NO CASCADE BEFORE INSERT ON UM_HYBRID_GROUP_ROLE
REFERENCING NEW AS NEW FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
    SET (NEW.UM_ID)
        = (NEXTVAL FOR UM_HYBRID_GROUP_ROLE_SEQUENCE);END/
