4

I am trying to write a query. It will take employee IDs from a table, and assign random numbers between 1-45 in whole number increments. The data is in Oracle - sql.

3
  • I have tried to use DBMS.RANDOM but doesnt seem to provide me a solution. Commented Jun 14, 2017 at 18:33
  • Possible duplicate of stackoverflow.com/a/1568679/2630032 Commented Jun 14, 2017 at 18:37
  • 1
    got it.. it worked thank you Commented Jun 14, 2017 at 18:45

1 Answer 1

6

Got it:

round(DBMS_RANDOM.VALUE (1, 45))  

round helps me get whole numbers.

Sign up to request clarification or add additional context in comments.

1 Comment

As stated here, you should use floor instead of round to ensure a better distribution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.