原sql server存储过程:CREATE  procedure spp_freecond_cfommcm (@POPNo varchar(11),@intCount int output)
as
declare @FundSource int
declare @ReturnValue floatselect @FundSource=FundSource  from TTQ_Basic where POPNo=@POPNo 
if rtrim(ltrim(@FundSource))=3
   Begin 
select  @ReturnValue=
case c.Channel 
When '1' Then a.MMCMper-b.Mld_MMCM-0.02
When '2' Then a.MMCMper-b.Mli_MMCM-0.02
end 
from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
where a.POPNo=@POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID if @ReturnValue>0 
select @intCount=0
else
select @intCount=1
   End
else
   Begin 
select  @ReturnValue=
case c.Channel 
When '1' Then a.MMCMper-b.Mld_MMCM
When '2' Then a.MMCMper-b.Mli_MMCM
end 
from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
where a.POPNo=@POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID if @ReturnValue>0 
select @intCount=0
else
select @intCount=1
   Endreturn @intcount我新改的oracle,但是出错了,55555
create or replace procedure spp_freecond_cfommcm
(p_POPNo in varchar2, intCount out int)
is
FundSource number;
ReturnValue number;
begin
  
  select FundSource into FundSource from TTQ_Basic where POPNo=p_POPNo; if rtrim(ltrim(FundSource))=3 then
   Begin 
     select  
     case c.Channel 
       When '1' Then a.MMCMper-b.Mld_MMCM-0.02;
       When '2' Then a.MMCMper-b.Mli_MMCM-0.02;
     end
      into ReturnValue
     from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
     where a.POPNo=p_POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID;
    
     if ReturnValue>0 then
     intCount:=0;
     else
     intCount:=1;
      end if;
   End
else
   Begin 
     select  
     case c.Channel 
     When '1' Then a.MMCMper-b.Mld_MMCM;
     When '2' Then a.MMCMper-b.Mli_MMCM;
     end 
      into ReturnValue
     from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
     where a.POPNo=p_POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID;
    
     if ReturnValue>0 then
     intCount:=0;
     else
     intCount:=1;
      end if;
   End
end if;
  
end spp_freecond_cfommcm;

解决方案 »

  1.   

    --如果还有错误,把错误贴出来
    create or replace procedure spp_freecond_cfommcm
    (p_POPNo in varchar2, intCount out int)
    is
    FundSource number;
    ReturnValue number;
    begin
      
      select FundSource into FundSource from TTQ_Basic where POPNo=p_POPNo; if rtrim(ltrim(FundSource))=3 then
    --begin     --不需要写    
    select  
        case c.Channel 
          When '1' Then a.MMCMper-b.Mld_MMCM-0.02 
          When '2' Then a.MMCMper-b.Mli_MMCM-0.02 
        end
          into ReturnValue
        from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
        where a.POPNo=p_POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID;
        
        if ReturnValue>0 then
        intCount:=0;
        else
        intCount:=1;
          end if;
    --   End   --不需要,如果想加,后面要加;
    else
      -- Begin 
        select   --select中不用加;
        case c.Channel 
        When '1' Then a.MMCMper-b.Mld_MMCM
        When '2' Then a.MMCMper-b.Mli_MMCM
        end 
          into ReturnValue
        from TTQ_CMCost a,vproductsellgate b,TTQ_Basic c 
        where a.POPNo=p_POPNo and a.POPNo=c.POPNo and b.ProductID=c.ProductID;
        
        if ReturnValue>0 then
        intCount:=0;
        else
        intCount:=1;
          end if;
    end if;
      
    end spp_freecond_cfommcm;
      

  2.   

    谢谢冰,编译通过了,我自己有些问题,channel是整型的,所以要去掉单引号,sql server 好像这个关系不大