question: private static void checkTableID ( Properties ctx , SvrProcess sp ) { int IDRangeEnd = DB . getSQLValue ( null , "SELECT IDRangeEnd FROM AD_System" ) ; if ( IDRangeEnd <= 0 ) IDRangeEnd = DB . getSQLValue ( null , "SELECT MIN(IDRangeStart)-1 FROM AD_Replication" ) ; s_log . info ( "IDRangeEnd = " + IDRangeEnd ) ; String sql = "SELECT * FROM AD_Sequence " + "WHERE IsTableID='Y' " + "ORDER BY Name" ; int counter = 0 ; PreparedStatement pstmt = null ; String trxName = null ; if ( sp != null ) trxName = sp . get_TrxName ( ) ; try { pstmt = DB . prepareStatement ( sql , trxName ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { MSequence seq = new MSequence ( ctx , rs , trxName ) ; int old = seq . getCurrentNext ( ) ; int oldSys = seq . getCurrentNextSys ( ) ; if ( seq . validateTableIDValue ( ) ) { if ( seq . getCurrentNext ( ) != old ) { String msg = seq . getName ( ) + " ID  " + old + " -> " + seq . getCurrentNext ( ) ; if ( sp != null ) sp . addLog ( 0 , null , null , msg ) ; else s_log . fine ( msg ) ; } if ( seq . getCurrentNextSys ( ) != oldSys ) { String msg = seq . getName ( ) + " Sys " + oldSys + " -> " + seq . getCurrentNextSys ( ) ; if ( sp != null ) sp . addLog ( 0 , null , null , msg ) ; else s_log . fine ( msg ) ; } if ( seq . save ( ) ) counter ++ ; else s_log . severe ( "Not updated: " + seq ) ; } } rs . close ( ) ; pstmt . close ( ) ; pstmt = null ; } catch ( Exception e ) { s_log . log ( Level . SEVERE , sql , e ) ; } try { if ( pstmt != null ) pstmt . close ( ) ; pstmt = null ; } catch ( Exception e ) { pstmt = null ; } s_log . fine ( "#" + counter ) ; }
target:  Check Table Sequence ID values