jeudi 9 juin 2016

Populate randomically a numeric or monetary field

This is my table: Table

I did this to populate it:

update AEROPORTO.RESERVA set VALOR = random()*(5000-1500)+1500 where cod_reserva is not null

but random func. has double precision and i what my values like this:

  • 111,11
  • 222,22

and round func. doesn't use double precision.

I've tryed to change the data type of the field Valor but didn't worked. Tryed numeric, monetary and float.

I need to run a script that populates randomically this field with only 2 digits precision.

Please help.

PS This is POSTGRES




Aucun commentaire:

Enregistrer un commentaire