Jdbc problem when tracking column is fixed decimal

I have a table where the tracking value has to be constructed from two integers: batch and index.
So, I created a fixed decimal "bistamp" like 123.0034, 124.0003, etc. using:

select
   ...
   to_number(to_char ( batch , 'FM999999' ) || '.' || to_char ( index , 'FM0000' ) , '999999.9999') as bistamp,
where
   ...
   to_number(to_char ( batch , 'FM999999' ) || '.' || to_char ( index , 'FM0000' ) , '999999.9999')  > :sql_last_value

The problem is that $HOME/.logstash_jdbc_last_run stores this number as:

--- !ruby/object:BigDecimal '0:0.70380003e4'

And on subsequent runs, the value for :sql_last_value is 0.

Is this a bug ?

Thanks,