DETERMINISTIC in Oracle

Source: Internet
Author: User
I have been confused when I saw DETERMINISTIC for many times. I did an experiment today. We assume that ORACLE is a DETERMINISTIC function, which is called only once in SQL. If no

I have been confused when I saw DETERMINISTIC for many times. I did an experiment today. We assume that ORACLE is a DETERMINISTIC function, which is called only once in SQL. If no

I have been confused when I saw DETERMINISTIC for many times. I did an experiment today. We assume that Oracle is a DETERMINISTIC function, which is called only once in SQL. If DETERMINISTIC is not used, the values are different. After DETERMINISTIC is used, different sessions have the same value.

SQL> create or replace function f_t (I _p int) return number DETERMINISTIC is
I _rtn number;
Begin
I _rtn: = I _p * dbms_random.value (1, 10 );
Return I _rtn;
End;
/
The function has been created.

Session1:
SQL> select LEVEL, f_t (1) FROM DUAL CONNECT BY LEVEL <= 10;
LEVEL F_T (1)
--------------------
1 2.55732959
2 2.55732959
3 2.55732959
4 2.55732959
5 2.55732959
6 2.55732959
7 2.55732959
8 2.55732959
9 2.55732959
10 2.55732959
10 rows have been selected.

Session2:
SQL> select LEVEL, f_t (1) FROM DUAL CONNECT BY LEVEL <= 10;
LEVEL F_T (1)
--------------------
1 2.55732959
2 2.55732959
3 2.55732959
4 2.55732959
5 2.55732959
6 2.55732959
7 2.55732959
8 2.55732959
9 2.55732959
10 2.55732959
10 rows have been selected.

SQL> create or replace function f_t (I _p int) return number is
I _rtn number;
Begin
I _rtn: = I _p * dbms_random.value (1, 10 );
Return I _rtn;
End;
/
The function has been created.

SQL> select LEVEL, f_t (1) FROM DUAL CONNECT BY LEVEL <= 10;
LEVEL F_T (1)
--------------------
1 8.48649118
2 8.9396978
3 2.2786135
4 5.29205905
5 5.32847713
6 8.70095819
7 6.20471031
8 2.00101537
9 3.53814265
10 3.64991086
10 rows have been selected.

Oracle 11g installation manual on RedHat Linux 5.8 _ x64 Platform

Installing Oracle 12C in Linux-6-64

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

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.