if vi_users_flag <> 2 then
raise exc_error3;
end if;
elsif vi_users_num = 3 then
vv_user1 := substr(vv_capi_usernam,1,instr(vv_capi_usernam,',',1,1)-1);
vv_user2 := substr(vv_capi_usernam,instr(vv_capi_usernam,',',1,1)+1,(instr(vv_capi_usernam,',',1,2)-instr(vv_capi_usernam,',',1,1))-1);
vv_user3 := substr(vv_capi_usernam,instr(vv_capi_usernam,',',1,2)+1,(length(vv_capi_usernam)-instr(vv_capi_usernam,',',1,2)));
vv_user4 := null;
execute immediate 'select count(*) from all_users t where t.username in (
'''||vv_user1||''','''||vv_user2||''','''||vv_user3||''')' into vi_users_flag ;
if vi_users_flag <> 3 then
raise exc_error3;
end if;
else
vv_user1 := substr(vv_capi_usernam,1,instr(vv_capi_usernam,',',1,1)-1);
vv_user2 := substr(vv_capi_usernam,instr(vv_capi_usernam,',',1,1)+1,(instr(vv_capi_usernam,',',1,2)-instr(vv_capi_usernam,',',1,1))-1);
vv_user3 := substr(vv_capi_usernam,instr(vv_capi_usernam,',',1,2)+1,(instr(vv_capi_usernam,',',1,3)-instr(vv_capi_usernam,',',1,2))-1);
vv_user4 := substr(vv_capi_usernam,instr(vv_capi_usernam,',',1,3)+1,(length(vv_capi_usernam)-instr(vv_capi_usernam,',',1,3)));
execute immediate 'select count(*) from all_users t where t.username in ('''||vv_user1||''','''
||vv_user2||''','''||vv_user3||''','''||vv_user4||''')' into vi_users_flag ;
if vi_users_flag <> 4 then
raise exc_error3;
end if;
end if;