Generate a function in Oracle that contains uppercase and lowercase characters and numbers

Source: Internet
Author: User
Tags chr


function createstring (n_num in number) return VARCHAR2 is

I integer default 0;

V_token varchar2 (+) default ';

Begin

While I < N_num loop

If MoD (Round (Dbms_random.value (1, 2), 2) > 0 Then

--Generate characters

if (MoD (Round (Dbms_random.value (1, 2), 2) > 0) Then

--Generate uppercase characters

V_token: = Concat (V_token,

Chr (+ floor (dbms_random.value (0, 26)));

Else

--Generate lowercase characters

V_token: = Concat (V_token,

CHR + floor (dbms_random.value (0, 26)));

End If;

Else

--Generate numbers

V_token: = concat (V_token,to_char (Floor (dbms_random.value (0, 10)));

End If;

I: = i + 1;

End Loop;

return v_token;

End


Generate a function in Oracle that contains uppercase and lowercase characters and numbers

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.