+ -
当前位置:首页 → 问答吧 → oracle存储过程应该怎么转到sql server

oracle存储过程应该怎么转到sql server

时间:2011-08-12

来源:互联网

SQL code

CREATE OR REPLACE PROCEDURE pro_paper_auto_make3_1(
p_plan_id number
)
is

 v_point_per number(5,1);
 v_question_no_b number;
 v_difficult_y number;
 v_difficult_z number;
 v_difficult_n number;
 v_question_type varchar2(8);

 v_question_id number;

 j number default 0;
 k number default 0;
 v_kong_num number default 0;

cursor  cur_plan_detail  is
select
c.question_no_b,c.point_per, c.difficult_y,c.difficult_z,c.difficult_n,c.type
from t_test_plan a,t_test_paper_question_b c
where  a.id = c.plan_id
and a.id = p_plan_id
order by question_no_b
;

begin
delete from t_test_paper_question_temp where paper_id=p_paper_id;
open cur_plan_detail;
loop <<planloop>>
  fetch cur_plan_detail into v_question_no_b,v_point_per,v_difficult_y,v_difficult_z,v_difficult_n,v_question_type;
  exit when cur_plan_detail%notfound;


   j:=1;
   k:=1;

  begin

       while j<=v_difficult_y+v_difficult_z+v_difficult_n loop <<difficult_loop>>
         
       ......
       
        end loop difficult_loop;
        
  end;

end loop planloop;
close cur_plan_detail;

commit;

end;



大家帮忙看下、是不是sql server 里没有loop循环啊? 如果没有的话那应该怎么改?

主要说下loop 循环 和 while 循环那块应该怎么改就行了

作者: caolong0210   发布时间: 2011-08-12

这个没试过,不过语法方面好像差不多,Lz可以根据sql server的语法改下

作者: luohuijun619   发布时间: 2011-08-12

copy到SqlServer里慢慢调。

作者: softroad   发布时间: 2011-08-12

如果楼主使用的是标准SQL,那改动的地方很少了,

作者: softroad   发布时间: 2011-08-12

引用 3 楼 softroad 的回复:
如果楼主使用的是标准SQL,那改动的地方很少了,

不是吧 、貌似在procedure 中定义的变量 每个千面都要加@符号、光这一项 花了我老长时间呢

作者: caolong0210   发布时间: 2011-08-12

怎么没人了啊 、 帮帮忙给我说下 loop循环那块和while 循环那块 应该怎么改啊

作者: caolong0210   发布时间: 2011-08-12

热门下载

更多