[20180927]ora-01426.txt

--//链接:http://www.itpub.net/thread-2105458-1-1.html
1.环境:
SCOTT@test01p> @ ver1

PORT_STRING                    VERSION        BANNER                                                                               CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0           12.1.0.1.0     Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0

set serveroutput on

DECLARE
  L_NUMBER number;
BEGIN
  L_NUMBER := 1024 * 1024 * 1024 * 1024;
  DBMS_OUTPUT.PUT_LINE(L_NUMBER);
END;
/

DECLARE
*
ERROR at line 1:
ORA-01426: numeric overflow
ORA-06512: at line 4

--//1024*1024 = 1048576
--//1048576*1048576 = 1099511627776

d:\blog>oerr ora 1426
01426, 00000, "numeric overflow"
// *Cause: Evaluation of an value expression causes an overflow/underflow.
// *Action: Reduce the operands.

DECLARE
  L_NUMBER number;
BEGIN
  L_NUMBER := 1024 * 1024 * 1024 * 1024.0;
  DBMS_OUTPUT.PUT_LINE(L_NUMBER);
END;
/

1099511627776
PL/SQL procedure successfully completed.
--//使用小数点,等于浮点运算,出现类型转换.
--//写成如下,一样通过,也证明没有溢出:

DECLARE
  L_NUMBER number;
BEGIN
  L_NUMBER := 1024 * 1024 * 1024;
  L_NUMBER :=L_NUMBER *1024 *1024*1024;
  DBMS_OUTPUT.PUT_LINE(L_NUMBER);
END;
/

1152921504606846976
PL/SQL procedure successfully completed.

SCOTT@test01p> set serverout on
SCOTT@test01p> DECLARE
  2    L_NUMBER number;
  3  BEGIN
  4      L_NUMBER := 2147483647-1+1;
  5      L_NUMBER := 2147483647+1-1;
  6       DBMS_OUTPUT.PUT_LINE(L_NUMBER);
  7  END;
  8  /
DECLARE
*
ERROR at line 1:
ORA-01426: numeric overflow
ORA-06512: at line 5

--//很明显oracle在一个算式里面达到2^31 就报错.改成如下也不会报错

DECLARE
  L_NUMBER number;
BEGIN
   -- L_NUMBER := 2147483647-1+1;
    L_NUMBER := 2147483647;
    L_NUMBER := L_NUMBER+1-1;
     DBMS_OUTPUT.PUT_LINE(L_NUMBER);
END;
/

2147483647
PL/SQL procedure successfully completed.

[20180927]ora-01426.txt的更多相关文章

  1. pl/sql dev安装

    转载: https://www.cnblogs.com/moly/p/8287091.html https://www.cnblogs.com/wuxiaokai/p/5032984.html 安装: ...

  2. Linux内核配置选项

    http://blog.csdn.net/wdsfup/article/details/52302142 http://www.manew.com/blog-166674-12962.html Gen ...

  3. [20170914]tnsnames.ora的管理.txt

    [20170914]tnsnames.ora的管理.txt --//昨天朋友讲tnsnams.ora的内容太长了,而且许多不需要的.管理不方便.我记得以前写[20150409]tnsnames.ora ...

  4. [20191108]内核参数tcp_keepalive与sqlnet.ora expire_time的一些总结.txt

    [20191108]内核参数tcp_keepalive与sqlnet.ora expire_time的一些总结.txt --//前几天在做12c DCD SQLNET.EXPIRE_TIME相关测试时 ...

  5. Oracle Net Listener Parameters (listener.ora)(转)

    12/20 7 Oracle Net Listener Parameters (listener.ora) This chapter provides a complete listing of th ...

  6. [20190419]shared latch spin count.txt

    [20190419]shared latch spin count.txt --//昨天测试exclusive latch spin count = 20000(缺省).--//今天测试shared ...

  7. [20190418]exclusive latch spin count.txt

    [20190418]exclusive latch spin count.txt--//昨天测试"process allocation" latch,主要这个latch与其它拴锁s ...

  8. [20190417]隐含参数_SPIN_COUNT.txt

    [20190417]隐含参数_SPIN_COUNT.txt--//在探究latch spin计数之前,先简单探究_SPIN_COUNT.实际上oracle现在版本latch spin的数量不再是200 ...

  9. [20190416]process allocation latch.txt

    [20190416]process allocation latch.txt --//看链接:http://andreynikolaev.wordpress.com/2010/12/16/hidden ...

随机推荐

  1. jmeter 新手使用教程

    jmeter是一款很好的接口和压力测试工具,下载就不说了,去jmeter官网下载即可. 解压缩到本地,然后进入bin文件夹点击jmeter.bat 一.新建一个线程组 线程组内各项配置的含义 二.添加 ...

  2. tomcat编译项目后,classes文件没有相应的改变;

    tomcat编译项目后,classes文件没有相应的改变: tomcat不能将项目部署到服务器: 1.首先,在tomcat安装目录webapps中将编译后的整个项目删掉,然后再在eclipse将tom ...

  3. asp.net core 2.1 配置管理

    1. 直接读取配置 StartUp类中使用 Configuration["ConnectionString"], Configuration["AliyunAkSk:Ak ...

  4. Spring Boot 设置静态资源访问

    问题描述 当使用spring Boot来架设服务系统时,有时候也需要用到前端页面,当然就不可或缺地需要访问其他一些静态资源,比如图片.css.js等文件.那么如何设置Spring Boot网站可以访问 ...

  5. Jquery ajax, Axios, Fetch区别之我见(转载)

    来源:https://segmentfault.com/a/1190000012836882 引言 前端技术真是一个发展飞快的领域,我三年前入职的时候只有原生XHR和Jquery ajax,我们还曾被 ...

  6. npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'

    在使用 npm 命令安装常用的 Node.js web框架模块 express时出现: 解决方法是 在命令行切换到安装nodejs文件下的nodejs\node_modules\npm  后执行npm ...

  7. C#设计模式之十九策略模式(Stragety Pattern)【行为型】

    一.引言 今天我们开始讲“行为型”设计模式的第七个模式,该模式是[策略模式],英文名称是:Stragety Pattern.在现实生活中,策略模式的例子也非常常见,例如,在一个公司中,会有各种工作人员 ...

  8. Java中对象和json互相转换的工具类

    package com.Dingyu.util; import java.util.List; import com.fasterxml.jackson.core.JsonProcessingExce ...

  9. 如何处理Express异常?

    译者按:根据墨菲定律:“有可能出错的事情,就会出错”.那么,既然代码必然会出错,我们就应该处理好异常. 原文: How to handle errors in Express 译者:Fundebug ...

  10. div和span标签

    ------------------------ ------------------------ ------------------------ 块级标签独占一行,不和别的标签在同一行显示:行内标 ...