postgres Query update decimal increment + 1

830 views Asked by At

I Need to Build a query to update a certain field need to increment the last number of a decimal number stored as a varchar:

'1481126826.2363343' => '1481126826.2363344'
UPDATE callcenter.chamada_agente 
  SET uniqueid = SUM('1481126826.2363343' + 1) 
WHERE id_chamada_agente = 32408 

Is possible to be done in postgresql? if not I can do this in my java code too.

-- UPDATED QUESTION ---

Big problem: uniqueid is VARCHAR, and my postgres version is 9.2

1

There are 1 answers

0
J. Alderete On BEST ANSWER

You could do this:

UPDATE callcenter.chamada_agente 
  SET uniqueid = '1481126826.2363343'::decimal+0.0000001
WHERE id_chamada_agente = 32408 

I'm converting uniqueid to decimal using "::" just for the operation, tested it on my own db and the result was '1481126826.2363344'.