• Oracle数据库空值操作


      空值操作:

      null表示空的意思。

      一、情况:

      1:表中的任何字段默认情况下都可以为null值。

      2:not null表示非空,是一种约束 设置为非空约束的字段,必须有有效值,不能为空。

      3:插入数据时 reg:insert into emp(ename,empno) values(2001,'张三');此记录中,没有赋值的字段都是null值。

      reg:insert into emp(ename,empno) values(2001,null);此记录中,字段empno为null值

      4:修改数据时:

      (1)当空值为条件是

      update emp set ename='张三' where comm is null;

      (2)当被设置为null时,

      update emp set name = null;

      5:当空值参与计算时 null相当于无穷大 1+null等于null null也不等于null。

      二、空值操作函数:

      1)nvl(p1,p2) 表示如果p1这个字段的值为null,就是用p2,否则使用p1。

      2)nvl2(p1,p2,p3) 表示如果p1不是null就使用p2,如果是null就使用p3。(编辑:雷林鹏 来源:网络)

  • 相关阅读:
    [spring] SpEL
    [spring学习2] 装配
    [spring] proxyMode
    [spring] @PropertySource
    [一些问题] 在vscode中添加jar库
    [spring] ApplicationContext相关问题
    gradle 打包
    [spring学习1] IoC容器
    spring快速开始
    准备要写的笔记备忘录
  • 原文地址:https://www.cnblogs.com/pengpeng1208/p/9472568.html
Copyright © 2020-2023  润新知