Fix saving groups on Oracle

cherry-pick of c49be4d2f