DBMS_RANDOM.VALUE OR DBMS_RANDOM.STRING

sponsored links
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;
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of DBMS_RANDOM.VALUE OR DBMS_RANDOM.STRING

  • eclipse Hibernate proposals

    Error: The 'Hibernate proposals' proposal computer from the' org.hibernate.eclipse.jdt.ui 'plug-in dod not complete normally. Unable to instantiate the extension. To Avoid this message, disable the 'org.hibernate.eclipse.jdt.ui ...

  • Rails2.0.2 change the default DB adpter

    In Rails2.0.2 rails demo ... ... MissingSourceFile in SayController # hello no such file to load - sqlite3 RAILS_ROOT: / home / kenb / rails-projects / demo ... ... Checked config / database.yml, adpter default is set become the sqlite3. Check the ra ...

  • The company first entered the company I would like to Optimize SQL project

    I was a time not long into the company of people, but also a person to be graduated, but immediately entered the project team, involved in the development. The project is to make a China Telecom Operation System, is a big system. My so-called develop ...

  • EJB ant script to deploy template works

    <? xml version = "1.0" encoding = "UTF-8"?> <! - Name Project name basedir build.xml file directory -> <project name="HelloWorld" basedir="."> <! - Property variables -> <! - The sour ...

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • Hibernate Mapping Types

    Hibernate mapping types divided into two categories: built-in mapping types and mapping types of customers. Built-in mapping types is responsible for some common Java types are mapped to the corresponding SQL type; In addition, Hibernate also allows users

  • Oracle instant clent for ruby / rails on cygwin

    Environment: XP: oracle full client, ruby, rails, gem cygwin: ruby rails, gem (the version with the XP version) Needs: for cygwin is installed under the rails platform support oci Steps: <1> download oracle instant client (10.2.0.3 Instant Client Pa

  • spring + hibernate + oracle9i to read and write CLOB

    Database-driven update classes12-9i.jar Hibernate modify the configuration of the following code <bean/> <bean Lazy-init="true"> <property name="nativeJdbcExtractor"> <ref local="nativejdbcExtractor"/>

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries