oracle deterministic 关键字
多次看到DETERMINISTIC,一直很疑惑,今天做了一个实验。我们欺骗Oracle说是一个DETERMINISTIC函数,它在SQL中只调用一次。如果不使用DETERMINISTIC,可以看到出来的值都不一样。使用DETERMINISTIC后,不同的会话都出来一样的值。
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;
/
函数已创建。
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行。
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;
/
函数已创建。
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行。
oracle deterministic 关键字的更多相关文章
- Oracle Minus关键字
Oracle Minus关键字 SQL中的MINUS关键字 SQL中有一个MINUS关键字,它运用在两个SQL语句上,它先找出第一条SQL语句所产生的结果,然后看这些结果有没有在第二个SQL语句的结果 ...
- Sql for Oracle基本操作关键字
Sql for Oracle基本操作关键字 +SQL TOP子句 TOP 子句用于规定要返回的记录的数目 SELECT column_name(s) FROM table_name WHERE ROW ...
- oracle ORA-01747(系统保留关键字)user.table.column, table.column 或列说明无效 hibernate映射oracle保留关键字
1.查询系统关键 select * from v$reserved_words 确认你使用的是否为关键字: select * from v$reserved_words w where w.KEYWO ...
- Oracle多关键字查询
因项目需要,在某查询页面的查询字段支持多关键字查询,支持空格隔开查询条件,故实现如下: 使用的原理是:ORACLE中的支持正则表达式的函数REGEXP_LIKE, '|' 指明两项之间的一个选择.例子 ...
- oracle 之关键字exists
-----------------------------------------------------------------------SQL中EXISTS的用法---------------- ...
- Oracle SQL 关键字
1.UID返回标识当前用户的唯一整数SQL> show userUSER 为"GAO"SQL> select username,user_id from dba_use ...
- Oracle case 关键字的使用
select e.salary, --case 语句开始 case then salary else salary end new_salary --case 语句结束,可见也和存储过程等结束方式一样 ...
- Oracle多关键字模糊查询
以前写SQL时,知道MySQL多字段模糊查询可以使用[charlist] 通配符,如: SELECT * FROM Persons WHERE City LIKE '[ALN]%'但是在Oracle中 ...
- oracle常用关键字和函数
数据库的增删改查: 增:insert into ... values(); 例:insert into p_emp values(sq_emp.nextval,,sysdate,,null,,); c ...
随机推荐
- 3分钟4个步骤超级简单入门配置lamp
按照我下面的推荐博客进行3步安装,最后进行一步测试就完成了.环境:我的环境是在windows10中安装的VMware中安装的Ubuntu虚拟机,Windows8,7应该是一样的测试:分别用localh ...
- POJ 1654 Area(水题)
题目链接 卡了一下精度和内存. #include <cstdio> #include <cstring> #include <string> #include &l ...
- ubuntu 12.04 安装wireshark
轉載自http://blog.chinaunix.net/uid-27064719-id-3786626.html 在ubuntu 12.04下安装wireshark软件之后,打开wireshark开 ...
- ECMAScript中关于如何获取this的定义
文章中一些名词的翻译存疑,没有查过正式的中文名称 前面都是具体过程的解释,懒得看可以直接看获取思路 有关this的取值请移步JavaScript笔记--this的取值 获取this的过程 Runtim ...
- [LintCode] Median of Two Sorted Arrays 两个有序数组的中位数
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted ...
- [LintCode] 3Sum 三数之和
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...
- iOS Notification 的使用
Notification post notification,notification,notification,notification,notification,n otification ,no ...
- java笔记随笔
基本语法 编写Java程序时,应注意以下几点: 大小写敏感:Java是大小写敏感的,这就意味着标识符Hello与hello是不同的. 类名:对于所有的类来说,类名的首字母应该大写.如果类名由若干单词组 ...
- sbt commands
速查手册 常用命令 actions – 显示对当前工程可用的命令 update – 下载依赖 compile – 编译代码 test – 运行测试代码 package – 创建一个可发布的jar包 p ...
- jQuery设计思想之取值和赋值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...