如下修改:
create or replace procedure checkidpass
(code in varchar, pass in varchar, v_result out number) is
userpass varchar(20);
username varchar(20);begin
select user_pass,user_name
    into userpass,username
    from operateuser
  where user_code = code;
   
    V_RESULT:=1;
exception 
  when no_data_found then
    V_RESULT:=0;end checkidpass;

解决方案 »

  1.   

    create or replace procedure checkidpass
    (code in varchar, pass in varchar, v_result out number) is
    userpass varchar(20);
    username varchar(20);begin
    select user_pass,user_name
        into userpass,username
        from operateuser
      where user_code = code;
       
      if userpass is null or userpass <> pass then
        V_RESULT:=0;
      else
        V_RESULT:=1;
      end if; 
    exception 
    when no_data_found then v_result := 0;
    end checkidpass;
      

  2.   

    加上
    begin
    select count(1)
        into num
        from operateuser
      where user_code = code and user_pass = pass;if num=0 thenV_RESULT:=0;
      else
        V_RESULT:=1;
      end if; 
    end
      

  3.   

    bzszp(SongZip) 的方法简单在大数据量时,使用1楼,2楼的
      

  4.   

    此速度会快
    begin
    select 1 into V_RESULT from operateuser where exists(select count(1)
        from operateuser
      where user_code = code); exception 
      when no_data_found then
        V_RESULT:=0;
      

  5.   

    create or replace procedure checkidpass
    (code in varchar, pass in varchar, v_result out number) is
    userpass varchar(20);
    username varchar(20);
    l_count  number(10);
    begin
    select max(user_pass),max(user_name),count(*)
        into userpass,username,l_count
        from operateuser
      where user_code = code;
       
      if l_count=0 or userpass is null or userpass <> pass then
        V_RESULT:=0;
      else
        V_RESULT:=1;
      end if; end checkidpass;