Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PL/SQL中生成随机字符串(oracle 12c)_Oracle_Plsql_Oracle12c - Fatal编程技术网

在PL/SQL中生成随机字符串(oracle 12c)

在PL/SQL中生成随机字符串(oracle 12c),oracle,plsql,oracle12c,Oracle,Plsql,Oracle12c,我试图使用PL/SQL生成一个随机字符串,其中只有2个固定单词。这是可能的吗?这就是你要找的吗 SQL> with 2 -- two fixed words 3 test as 4 (select 'fixed words' col from dual), 5 -- split them to rows 6 inter as 7 (select level lvl, regexp_substr(col, '.', 1, level) let

我试图使用PL/SQL生成一个随机字符串,其中只有2个固定单词。这是可能的吗?

这就是你要找的吗

SQL> with
  2  -- two fixed words
  3  test as
  4    (select 'fixed words' col from dual),
  5  -- split them to rows
  6  inter as
  7    (select level lvl, regexp_substr(col, '.', 1, level) let
  8     from test
  9     connect by level <= length(col)
 10    )
 11  -- aggregate them back, randomly
 12  select listagg(let, '') within group (order by dbms_random.value(1, max_lvl)) result
 13  from inter
 14  join (select max(lvl) max_lvl from inter) on 1 = 1;

RESULT
--------------------------------------------------------------------------------
reiosdwxf d

SQL> /

RESULT
--------------------------------------------------------------------------------
fe ixoddrws

SQL> /

RESULT
--------------------------------------------------------------------------------
 wdxeorsdfi

SQL>

你说只有两个固定词是什么意思?你能举个例子来更新这个问题吗?