Oracle Random Character from a String

Submitted by:Pitter Alderson

Date added:09 April, 2013

Category:SQL

To produce a random character from a specific list of characters (for example 'x', 'y' or 'z')

Tags: random character

Code Snippet:

SELECT SUBSTR('xyz',ROUND(DBMS_RANDOM.VALUE(1,3)),1) FROM DUAL; -- where 3 is the length of the string 'xyz'.
 
 

Comments