본문 바로가기

IT 연구회

오라클오류코드로 SQLException

반응형

public static String defaultErrHandler(Exception e) {
   e.printStackTrace();
   if (e instanceof ProFrameException)
     e = (Exception)e.getCause();

   if (e instanceof NullPointerException) {
     return "COMA001001";
   } else if (e instanceof SQLException) {
     SQLException se = (SQLException) e;
     switch (se.getErrorCode()) {
     case 1:  // ORA-00001 (무결성 제약 조건(ENT.EUA050PK)에 위배됩니다)
       return "COMA001002";
     case 984:  // ORA-00984 (열을 사용할 수 없습니다.)
       return "COMA001001";
     case 1400:
       return "COMA001001";
     case 1722:
       return "COMA001001";
     case 3114:
       return "COMA001001";
     }
   }
   return othersErrHandler(e);
 }

 


반응형