But in real time scenario SOC (look-up table) gives me error

Are these compile errors or run errors?

i dont have anything

So are these imaginary errors?

but i want to create look-up table measuring voltages in ocv method

Then create one what is the problem? You need to have the graph for your sort of battery so then you get a list of voltages and what that voltage represents in terms of battery capacity and put that in a lookup table.

how to derive a formula if you have only voltages values?

You still need the table of voltages and what battery capacity that represents like you need for the lookup table, then you need to find a graph which approximates to that table. The simplest form of equation is one of a straight line Y = mX + C, but if the relationship is not a straight line then you need something like this
equation from a graph