I'm trying to generate a Random String using PL/SQL with some restricted letters, because i want to avoid letters like O, o, 0, etc. I heard that this task can be achievable using the listagg function available in oracle 11g. But i want to achieve this using Oracle 9i as we are using this in our environment. Any suggestions will be appreciated.
Try using DBMS_RANDOM package to generate random strings.
Ex : dbms_random.string('x',10)
gives uppercase alphanumeric character string of length 10.
But you cant exclude specific characters. You will have to use TRANSLATE
or REPLACE
functions to remove the unwanted characters.
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