전송 그룹 매개 변수 저장 프로세스로

4082 단어
    /**
     *             
     * @param jwxhs     (    )    ,           (eg.123   123.jpg)
     * @param undirectoryPath           
     */
    private void synaZp(String[] jwxhs, String undirectoryPath) {
        CallableStatement stmt = null;
        //             
        XsxxglAMImpl am = (XsxxglAMImpl) ADFUtils.getApplicationModuleForDataControl("XsxxglAMDataControl");
        Connection cn;
        try {
            cn = am.getDBTransaction().createStatement(0).getConnection();
            //            
            ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TYPE_JWXH_VARCHAR2", cn);
            String batchSQL = "begin xjxxgl_syncZp(?, ?, ?); end;";
            stmt = am.getDBTransaction().createCallableStatement(batchSQL, 0);
            ARRAY jwxh_RXNY = new ARRAY(desc, cn, jwxhs);
            stmt.setObject(1, jwxh_RXNY);
            stmt.setObject(2, undirectoryPath);
            stmt.registerOutParameter(3, Types.NUMERIC);
            stmt.execute();
            System.out.println("    :"+stmt.getString(3));
            if (!stmt.getString(3).equals("0")) {
                am.getDBTransaction().commit();
            }
            JSFUtils.addFacesInformationMessage("    ,   " + stmt.getString(3) + "   ");
        } catch (java.sql.SQLException s) {
            s.printStackTrace();
            throw new oracle.jbo.JboException(s);
        } catch (Exception e) {
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
            } catch (java.sql.SQLException s2) {
                throw new oracle.jbo.JboException(s2);
            }
        }
    }

데이터베이스에 있는 그룹 형식을 정의해야 합니다.
Connection cn;
cn = am.getDBTransaction().createStatement(0).getConnection();
//데이터베이스의 객체 배열 유형을 정의합니다. ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TYPE_JWXH_VARCHAR2", cn);
            ARRAY jwxh_RXNY = new ARRAY(desc, cn, jwxhs);            stmt.setObject(1, jwxh_RXNY);
-----------
jwxhs는 문자열의 그룹입니다.
create or replace procedure xjxxgl_syncZp(p_jwxhs IN TYPE_JWXH_VARCHAR2,
                                          p_path  IN VARCHAR2,
                                          p_count out NUMBER) is

  /**
  *          

  *  2015 9 7 
  
  p_jwxhs           
  p_path            
  p_count         
  */
  TYPE XSCUR IS REF CURSOR; --      
  CUR_XS XSCUR; --         
  --                       ,
  --  PL/SQL                 ,         ,
  --                     

  XSTEMP_XH VARCHAR2(30);
  count_start number;  --         
  count_end   number;  --         

BEGIN
  select count(*) into count_start from xsxxgl_xsjbxx WHERE zppath is not null;
  FOR I in p_jwxhs.first .. p_jwxhs.last LOOP
  
    OPEN CUR_XS FOR
      SELECT xs.jwxh
        FROM xsxxgl_xsjbxx xs
       WHERE xs.jwxh = p_jwxhs(I)
         and xs.zppath is null;
    FETCH CUR_XS
      INTO XSTEMP_XH;
  
    --          ,            ,       
    IF CUR_XS% FOUND THEN
      --           
      --     
      UPDATE xsxxgl_xsjbxx YH
         SET YH.Zppath = '/imageservlet?path='||p_path||'/'||p_jwxhs(I)||'.jpg'
       WHERE YH.Jwxh = p_jwxhs(I);
    END IF;
  
    CLOSE CUR_XS;
  END LOOP;
  --      
  select count(*) into count_end from xsxxgl_xsjbxx WHERE zppath is not null;
  p_count := count_end - count_start;

exception
  when others then
    raise;
    rollback;
END xjxxgl_syncZp;

  
기능 발췌 자습공 시스템, 학생 정보 관리, 사진 대량 업로드

좋은 웹페이지 즐겨찾기