sql server的存储过程要改成oracle的create  procedure spp_freecond_commit(@POPNo varchar(11),@intCount int output)
as
declare @CommitTrainning int                               declare @CommitOther intselect @CommitTrainning=sum(UnitReserve*quantity)  from TTQ_CommitTrainning where POPNo=@POPNo
select @CommitOther=sum(Reserve)  from TTQ_CommitOtherOffer where POPNo=@POPNoif @CommitTrainning>0 or @CommitOther>0 
select @intCount=1
else
select @intCount=0return @intcount我现在改成这样,可是报错,大家帮我看看,多谢了create or replace procedure test_spp_freecond_commit(POPNo in varchar2(11),intCount  out number) is
beginCommitTrainning number;                                 CommitOther number;select sum(UnitReserve*quantity) into CommitTrainning from TTQ_CommitTrainning where POPNo=POPNo;
select sum(Reserve) into CommitOther from TTQ_CommitOtherOffer where POPNo=POPNo;if CommitTrainning>0 or CommitOther>0 then
intCount:=1;
else
intCount:=0;
end if;  
end test_spp_freecond_commit;

解决方案 »

  1.   

    select sum(UnitReserve*quantity) into CommitTrainning from TTQ_CommitTrainning where POPNo=POPNo;
    select sum(Reserve) into CommitOther from TTQ_CommitOtherOffer where POPNo=POPNo;变量名不要和列名相同create or replace procedure test_spp_freecond_commit(p_POPNo in varchar2,intCount  out number) is输入输出参数不加长度
      

  2.   

    create or replace procedure test_spp_freecond_commit(p_POPNo in varchar2,intCount  out number) is
    CommitTrainning number;                                 
    CommitOthernumber;
    beginselect sum(UnitReserve*quantity) into CommitTrainning from TTQ_CommitTrainning where POPNo=p_POPNo;
    select sum(Reserve) into CommitOther from TTQ_CommitOtherOffer where POPNo=p_POPNo;if CommitTrainning>0 or CommitOther>0 then
    intCount:=1;
    else
    intCount:=0;
    end if;end test_spp_freecond_commit;