public String getCurrentValueSql(String sequenceName) {
return "select START_WITH from INFORMATION_SCHEMA.SYSTEM_SEQUENCES where SEQUENCE_NAME = '"
+ sequenceName.toUpperCase() + "'";
}
calling getCurrentValueSql returns always the sequence’ starting value instead of the current value.
I think it would work by replacing sql code with:
"call current value for '" + sequenceName.toUpperCase() + "'";
or
"select (CAST(next_value AS INTEGER) - 1) from INFORMATION_SCHEMA.SYSTEM_SEQUENCES where SEQUENCE_NAME = '" + sequenceName.toUpperCase() + "'";