DBMS_RANDOM.VALUE OR DBMS_RANDOM.STRING

ORACLE random number of packets in the source file directory is: (ORACLE_HOME) \ RDBMS \ ADMIN \ dbmsrand.sql
1 .-- returns random number between 0,1 (including 0 and 1)

SQL> select dbms_random.value from dual;

     VALUE
----------
 .89972641

2 .-- Back 10-20 of random numbers (including 10 and 20)

SQL> select dbms_random.value(10,20) from dual;

DBMS_RANDOM.VALUE(10,20)
------------------------
              19.3048583

3.
/ *
NORMAL function returns the normal distribution of a group of numbers. The standard deviation of a normal distribution, expected value is 0.
This function returns the value in the range of 68% is between -1 and +1,
95% of the range between -2 and +2, 99% were between -3 and +3.
* /

SQL> select dbms_random.normal from dual;

    NORMAL
----------
1.08646246

- 4. The first parameter P said printable, which can be printed by any character string composed
The second parameter that returns the string length

SQL> select dbms_random.string('P',20) from dual;

DBMS_RANDOM.STRING('P',20)
----------------------------------------------------------------------
%b@e%u%Mq\S%v?@I87@U

- 5. Than character 'a' random string of 10 characters

SQL> select dbms_random.string('a',10) from dual;

DBMS_RANDOM.STRING('A',10)
---------------------------------------------------------------------
KJYypnMRTv

- 6. Generate a string of 20 uppercase characters

SQL> select dbms_random.string('U',20) from dual;

DBMS_RANDOM.STRING('U',20)
----------------------------------------------------------------------
ZPEVYJZNKKBEDPWYXWQU

- 7. Generate 20-character string lowercase

SQL> select dbms_random.string('L',20) from dual;

DBMS_RANDOM.STRING('L',20)
----------------------------------------------------------------------
akjjxbdzvenbpocyeipj

- 8. Generate a random number (positive or negative)

SQL> select dbms_random.random from dual;

    RANDOM
----------
-1.929E+09

- 9. Random access emp table 3 records

SELECT * FROM
(
SELECT * FROM EMP
ORDER BY DBMS_RANDOM.random
)where rownum <4;
分类:Database 时间:2010-04-20 人气:432
分享到:
blog comments powered by Disqus

相关文章

  • Query to modify the ORACLE server. Client and export dmp file character set encoding [turn] 2010-09-27

    Transfer: http://hi.baidu.com/anshang/blog/item/3a2319232d066f47925807b7.html Modify the oracle character set 2008-10-13 11:20 test time, the machine installed oracle using utf8 character set, and the requirements of the project is gbk character set,

  • Built-in function Daquan ORACLE ORACLE 10g Standard Edition 2010-12-30

    ORACLE built-in function Daquan SQL functions in a single record 1.ASCII Returns the character corresponding to the specified decimal number; SQL> select ascii ('A') A, ascii ('a') a, ascii ('0 ') zero, ascii (' ') space from dual; AA ZERO SPACE ----

  • ORACLE set client character set 2010-04-27

    1, some basic knowledge of the character set There are many character sets, the original character set is ASCII, characters as ASCII support is limited, then there a lot of coding schemes, most of these coding schemes include ASCII's. EBCDIC coding i

  • oracle call to traverse the disk file java class 2010-04-06

    Utl_file package that comes with using oracle access to a disk file, but there is limited - can not access the folder? What does that mean? Means that oracle can only access the specified file, folder and can not access the unknown files. So, if you

  • oracle & and 'special character processing 2011-06-08

    oracle & and 'special character processing Today, a number of importing data to Oracle, ran into a problem: Toad Tips (plsql, too) to give AMP a custom variable assignments at the beginning I was wondering, the data is a series of Insert statement, h

  • Oracle on the password and password file 2010-09-29

    To install the Oracle user into the system: Forgot your password: 1. At the command line, type sqlplus / nolog SQL * PLUS access 2. Input: conn / as sysdba 3. Change your password: alter user sys identified by "admin" 4. Then you can use the sys

  • oracle function - Go character processing function (reproduced) 2011-07-08

    oracle function - Go character handler Characters function - returns the character value These functions are all family to receive a parameter of type character (CHR excluded) and returns the character value addition of special note, the majority of

  • Oracle backup and recovery simple batch file - change 2010-03-31

    Recommendation one: Using Task Scheduler, batch files, and the EXP ORACLE export feature, can date back up files automatically generated ORACLE, ORACLE greatly facilitates data backup. : 1, the establishment of a batch file backup.bat \. exp system /

  • Oracle exp command to export dmp file data 2011-04-28

    linux root under su - oracle (not that may su oracle, oracle environment variables in it?) exp username / password file = / home / oracle / xxxxxxx.dmp tables = table owner. table buffer = 100000 feedback = 10000

  • Oracle oracle common function uses Daquan division 2010-07-02

    One operator arithmetic operators: + - * / can be used in the select statement concatenation operator: | | select deptno | | dname from dept; Comparison operators:>> = =! = <<= Like between is null in Logical operators: not and or Set operator

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.591 (s). 12 q(s)