본문 바로가기

카테고리 없음

JAVA 재귀 함수 호출 형태

//시퀀스 값을 가져와서 해당 값이 이미 중복되었는지 확인 후 중복이면 다시 시퀀스 채번 

//시퀀스 중복 확인은 중간에 특정 번호가 존재하는 상황을 위함

 

    private String  searchTestKey() throws Exception {
        String testKey = "";
        
        try {
            testKey = testService.testRegNsrcrNo(); // 시퀀스 채번 
            int testKeyCnt = testService.testRegNsrcrNoCnt(testKey); //채번된 시퀀스가 중복되었는지 체크 
            if (testKeyCnt > 0 ) {
                searchTestKey();
            }
            
        } catch (IOException e) {
            log.info(" IOException {}", "");
        }
      
        return testKey;
    }