Oracle dbms_random隨機函數包

來源:互聯網
上載者:User

標籤:alpha   ble   rac   png   string   div   它的   類型   功能   

dbms_random是oracle提供的一個隨機函數包,以下是它的一些常用的功能:

1、dbms_random.value

作用:產生一個大於等於0,大於等於1的隨機的38位小數,代碼如下:

select dbms_random.value random from dual

2、產生一個指定範圍的隨機數

select dbms_random.value(0,100) randomfrom dual

注:範圍交換位子是可行的。

3、擷取常態分佈的隨機數 

select dbms_random.normal from dual

 

4、擷取隨機的字串

通過dbms.random.string(參數一,參數二),這個函數接受兩個參數,第一個是隨機字串的類型,第二個是字串的長度

字串類型有以下幾個:

(1)、‘u‘,‘U‘ : upper case alpha characters only  大寫字母

(2)、‘L‘,‘l‘: lower case alpha characters only 小寫字母

(3)、‘a‘,‘A‘ : alpha characters only (mixed case) 大小寫混合

(4)、‘x‘,‘X‘ : any alpha-numeric characters (upper) 數字,大小寫字母混合

(5)、‘p‘,‘P‘ : any printable characters 數字、大小寫字母、符號等混合

select dbms_random.string(‘u‘,10) from dual union all select dbms_random.string(‘l‘,10) from dual union all  select dbms_random.string(‘a‘,10) from dual union all select dbms_random.string(‘x‘,10) from dual union all select dbms_random.string(‘P‘,10) from dual 

注:參數一不區分大小寫

Oracle dbms_random隨機函數包

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.