想写一个oracle存储过程
主要是更新一个字段
 传进一个数组:int[] ids  
for(int i=1;i<ids.length;i++) {update field set sort =i where id = ids[i];  }以上的我想用存储过程来表现,最后用hibernate调用过程,请问如何写呢

解决方案 »

  1.   

    大概 这个样子
    cur sys_refcousoropen cur for select rownum, ids from field ;
    fetch cur into i,ids
    loop
    update field set sort =i where id = ids;   end loop;
      

  2.   

    sys_refcursor  打错了呵呵
      

  3.   

    create or replace pro_test
    issz varchar(200);
    i integer;
    cursor cur_test is select ids from tempA;i:=1;
    begin
      open cur_test;
      loop
        fetch cur_test into sz;
        exit when cur_test%notfound;
        update field set sort =i where id = sz;
        i:=i+1;
        end loop;
        close cur_test;
        end;
      

  4.   

    for i arr 1..arr.count  loop
      

  5.   


    package as
     type record_type is record(id varchar2);
     type record_type_v is varray(100) of record_type;
     end;
     
     create procedure ok(arrays in record_type) 
     begin
            for i in arrays.first..arrays.last loop
                update update field set sort =i where id = arrays(i);   
            end loop;
     end;
      

  6.   

    package as
     type record_type is record(id varchar2);
     type record_type_v is varray(100) of record_type;
     end;
     
     create procedure ok(arrays in record_type) 
     as
     begin
            for i in arrays.first..arrays.last loop
                update update field set sort =i where id = arrays(i);   
            end loop;
     end;
      

  7.   

    高级开发工程师职位推荐
    岗位责任:
    1、Senior  Developer有3年以上的成功的软件产品或类似项目的开发经验。有较强的独立思考,判断和研发能力。能够比较准确的判断每个开发任务的工作量。对产品的质量和专业制造有比较成熟的经验和认识。
    2.Senior Developer 的主要任务是在产品研发经理(Team Leader/Manager)带领下参与实现8a产品开发。必须有较高的技术水平和团队工作能力,并对8a及其相关的技术要有较高的兴趣和钻研能力。要有能够主动接受技术挑战,并能够将任务实现到底的精神和动力。
    任职资格: 
    1.20岁以上,35岁以下,至少本科毕业,最好是国内1流大学理科的计算机专业。北京大学、清华大学、人民大学毕业生优先。 
    2.至少3年以上的软件公司的C/C++开发工作经验,用C/C++参与开发过成功的产品。 
    3.对 C/C++, Linux 系统必须有实际开发经验和高水平的掌握. 
    4.对参加过数据库开发的优先 
    5.对使用C/C++ 开发过系统内核(System Kernel), 网络通信 (Networking), 并行计算 (Parallel Computing),  分布式处理模式的优先 (Distributed Computing). 
    6.对Oracle ; Sybase IQ ; DB2等数据库有深入了解的优先 
    7.要求总结分析能力属于较高水平 
    8.英语必须有中等水平以上的读写能力,口语好的优先 
    9.要求开朗,积极,向上,能够承受一定的心理和工作压力
    岗位地点:北京 
    月薪20K以内
    Lade Chen
    Bilast & Associates, Inc. 
    R 1501 Tower B Xintiandi Building No.1 Xibahe Road Chaoyang District Beijing PRC.
    M:15011205431
    P: 8610.5128.6869-828
    Email: [email protected]
    F: 8610.5128.6869 ext.888