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?
If you really need a distinct random number, well, you're going to have to generate many, many more numbers than rows.
Note the following query:
Some example executions:
Looks like sub-query is the problem.
This seems to be working-