Need help with SQL - I want to generate and update a column in every row with a different random number.
Database # Oracle 10g.
Example - When I do something like this it updates all the rows with the same number
update mytable r
set r.generated_num =
(select floor(dbms_random.value(100,9999999)) from dual).
Any advice?
Looks like sub-query is the problem.
This seems to be working-
update mytable r set r.generated_num = TRUNC(dbms_random.value(1,9999999))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With