还是报错,可能是我的存储过程有问题,帮我看一下create procedure proc_pzc (@ID NUMBER, @UNIVERSITY varchar2(100), @CHENGWEI varchar2(50) output ) as declare @NUM number; declare @NUM2 number; declare @NUM3 number; declare @SEX varchar2(10); select @NUM=rownum from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID; select @NUM2=MIN(rownum) from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID; select @NUM3=max(rownum) from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID; select @SEX=v.SEX from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID; if @SEX='男' begin if @NUM=@NUM2 begin select @CHENGWEI="大师兄"; end else if @NUM=@NUM3 begin select @CHENGWEI="小师弟"; end else begin select @CHENGWEI=convert.toString(@NUM)+"师弟"; end
end else begin if @NUM=@NUM2 begin select @CHENGWEI="大师姐"; end else if @NUM=@NUM3 begin select @CHENGWEI="小师妹"; end else begin select @CHENGWEI=convert.toString(@NUM)+"师妹"; end end
exec proc_psc(11, '吉林大学', CHENGWEI );
dbms_output.putline(CHENGWEI );
(@ID NUMBER,
@UNIVERSITY varchar2(100),
@CHENGWEI varchar2(50) output
)
as
declare @NUM number;
declare @NUM2 number;
declare @NUM3 number;
declare @SEX varchar2(10);
select @NUM=rownum from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID;
select @NUM2=MIN(rownum) from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID;
select @NUM3=max(rownum) from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID;
select @SEX=v.SEX from v_peifeng_zy_userinfo_px v where UNIVERSITY=@UNIVERSITY and ID=@ID;
if @SEX='男'
begin
if @NUM=@NUM2
begin
select @CHENGWEI="大师兄";
end
else if @NUM=@NUM3
begin
select @CHENGWEI="小师弟";
end
else
begin
select @CHENGWEI=convert.toString(@NUM)+"师弟";
end
end
else
begin
if @NUM=@NUM2
begin
select @CHENGWEI="大师姐";
end
else if @NUM=@NUM3
begin
select @CHENGWEI="小师妹";
end
else
begin
select @CHENGWEI=convert.toString(@NUM)+"师妹";
end
end
拿SQL Server的来Oralce里玩,
小心Oracle的BOSS和你拼命啊。