分区语句整理 6

来源:互联网 发布:vibe算法 编辑:程序博客网 时间:2024/04/30 22:03

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;

0 0
原创粉丝点击