The table is
Name Type Length Scale Nulls Default
RATE_GROUP_CODE CHAR 8 0 N Y
The query is
select max(rate_group_code) as rgc
where substr(rate_group_code, 1, 2) = 'OD '
But, the result of the above query is always OD9.
However the table contains rate_group_code data from OD01 to OD28.
I need to change the query to find the top number after the OD in this table column, so that the next number can be incremented from it. For example, if rgc is OD28, then insert OD29 next. The column type cannot be changed.