初步接触oracle,不知道存储过程怎么改?

onlygirl2006 2007-02-12 10:56:30
sql server的存储过程要改成oracle的



create procedure spp_freecond_commit(@POPNo varchar(11),@intCount int output)
as
declare @CommitTrainning int

declare @CommitOther int

select @CommitTrainning=sum(UnitReserve*quantity) from TTQ_CommitTrainning where POPNo=@POPNo
select @CommitOther=sum(Reserve) from TTQ_CommitOtherOffer where POPNo=@POPNo

if @CommitTrainning>0 or @CommitOther>0
select @intCount=1
else
select @intCount=0

return @intcount

我现在改成这样,可是报错,大家帮我看看,多谢了

create or replace procedure test_spp_freecond_commit(POPNo in varchar2(11),intCount out number) is
begin

CommitTrainning 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;
...全文
165 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
icedut 2007-02-12
  • 打赏
  • 举报
回复
create or replace procedure test_spp_freecond_commit(p_POPNo in varchar2,intCount out number) is
CommitTrainning number;
CommitOthernumber;
begin

select 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;
icedut 2007-02-12
  • 打赏
  • 举报
回复
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

输入输出参数不加长度
onlygirl2006 2007-02-12
  • 打赏
  • 举报
回复
谢谢冰啊,很喜欢你这样有耐心,给我改了还告诉我原因

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧