等答案ing................
先谢啦

解决方案 »

  1.   

    CREATE PROCEDURE spBlacklist
    (
      p_Phone varchar2(15),
      p_BlacklistID int,
      p_Type integer,
      p_RetMsg out varchar2(150) 
    )
    AS
    v_UsrID integer;
    num number;
    begin
    select UsrID into v_UsrID from UsrInfo where Phone = p_Phone;
    if p_Type = 1 then
      begin
      select 1 into num from UsrInfo where UsrID =p_UsrID;
      exception 
      when others then
        return -2;
      end;
      begin
      select 1 into num from Blacklist where UsrID = v_UsrID and BlacklistID = p_BlacklistID;
       insert into Blacklist values(v_UsrID, p_BlacklistID, sysdate);
      exception
      when others then
      return -3;
      end;
    end if;
    if p_Type = 2 then
      begin
      select 1 into num from UsrInfo where UsrID = v_UsrID;
      exception
      when others then
        return -2;
      end;
      begin
      select 1 into num from Blacklist where UsrID = v_UsrID and BlacklistID = p_BlacklistID;
      delete Blacklist where UsrID =v_UsrID and BlacklistID = p_BlacklistID;
      exception
      when others then
      return -4;
      end;
    end if;
    if p_Type = 3 then
      begin
      select 1 into num from Blacklist where UsrID =v_UsrID;
      select BlacklistID into RetMsg from Blacklist where UsrID =v_UsrID;
      exception
      when others then
      return -5;
      end;
    end if;
    update Online set LastActivedTime = sysdate
      where UsrID = v_UsrID;
    if sql%notfound then
      return -1;
    else
      return 0;
    end if;
    end;
    /
      

  2.   

    to  beckhambobo:
    谢谢啊,还有在吗我编译了一下出现如下错误,不知道是什么原因啊
    行号= 17 列号= 5 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 17 列号= 5 错误文本= PL/SQL: Statement ignored
    行号= 24 列号= 3 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 24 列号= 3 错误文本= PL/SQL: Statement ignored
    行号= 32 列号= 5 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 32 列号= 5 错误文本= PL/SQL: Statement ignored
    行号= 39 列号= 3 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 39 列号= 3 错误文本= PL/SQL: Statement ignored
    行号= 48 列号= 3 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 48 列号= 3 错误文本= PL/SQL: Statement ignored
    行号= 54 列号= 3 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 54 列号= 3 错误文本= PL/SQL: Statement ignored
    行号= 56 列号= 3 错误文本= PLS-00372: 在一个过程中,RETURN 语句无法包含表达式
    行号= 56 列号= 3 错误文本= PL/SQL: Statement ignored
      

  3.   

    另外,这个参数定义里
    (
      p_Phone varchar2(15),       ---->p_Phone varchar2,
      p_BlacklistID int,
      p_Type integer,
      p_RetMsg out varchar2(150)   --->p_RetMsg out varchar2 
    )
    我试了一下,一定得把那个长度定义去掉才行啊,不知道是什么原因?