/ Published in: SQL
To produce a random word or string or phrase from a specific list of words, strings, or phrases (for example 'foo', 'bar' or 'baz').
If you want to add NULL's into the possibilities, make the "number of strings" (in this example, 3) a higher number that there are strings. The higher the number, the more NULL's will be produced.
Expand |
Embed | Plain Text
SELECT REGEXP_SUBSTR('foo, bar, baz','([^,]+)',1,ROUND(DBMS_RANDOM.VALUE(1,3))) FROM DUAL; -- Where 3 is the number of words.
You need to login to post a comment.
