oracle-Random Number acquisition

Source: Internet
Author: User

1, get 10-100 of data, retain two decimal places

Select Trunc (Dbms_random.value (10,100), 2) from dual;

2. Get 0-1 Decimals

Select Dbms_random.value from dual;

3. Get a random letter-3

Select Dbms_random.string (' x ', 3) from dual;

4. Get a random date

Select To_date (2454084+trunc (dbms_random. VALUE (0,365)), ' J ') from dual;

5. Generate a unique string

Select Sys_guid () from dual;

Application Examples:

Randomly generate test data for some fields of a table

Update AAA
Set

Zyl=trunc (Dbms_random.value (10,100), 2),
Cl=trunc (Dbms_random.value (10,100), 2),
Kccl=trunc (Dbms_random.value (10,100), 2),
Jjkccl=trunc (Dbms_random.value (10,100), 2),
Ncl=trunc (Dbms_random.value (10,100), 2),
Lcl=trunc (Dbms_random.value (10,100), 2)

oracle-Random Number acquisition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.