Hi Tam,
You are right - Since RANDDIGITS generates random numbers there is a bleak possibility that the numbers might not be unique, especially when you are generating a large number of records.
What you could use in this case is the NEXTVAL(SEQUENCE, STARTVAL) function.
This will return the next value in the specified sequence. If the sequence does not exist, a new one is created with a starting value of STARTVAL. Every subsequent call to the function increments the sequence by one.
For your specific requirement (9-digit SSN), you could use something like:
@nextval(MY_SSN,100000000)@
Thanks,
Sameer