「Oracle入门」 DBMS_RANDOM.RANDOM(STRING、VALUE)の使い方

1.乱数の取得
SELECT DBMS_RANDOM.RANDOM() AS RAND FROM DUAL;

RANDDIG
1510339687

2.(0.0~1.0)の乱数
SELECT DBMS_RANDOM.VALUE AS RANDVAL FROM DUAL;

RANDVAL
0.54222246419720795713470908705902261109

3.自然数の乱数
SELECT DBMS_RANDOM.NORMAL ANDNML FROM DUAL;

ANDNML
0.9091261603929238106428661337349463173353

4.ランダムの英小文字
SELECT DBMS_RANDOM.STRING('L’,8) AS ENVA FROM DUAL;

ENVA
gfrzxtea
ランダムの英大文字

SELECT DBMS_RANDOM.STRING('U’,8) AS ENVA FROM DUAL;

ENVA
MHAIGYDQ

8.(6,9)の浮動小数点の乱数
SELECT DBMS_RANDOM.VALUE(6,9) AS BETRAND FROM DUAL;

BETRAND
7.52199019866418662856371710185996781826

DataBase

Posted by arkgame