---
title: "ORACLE NVL 函数"
author: "gang.chen"
date: "2014-09-24T00:17:19Z"
tags: ["Oracle", "nvl"]
categories: ["数据库"]
slug: "oracle-nvl"
draft: false
lastmod: "2014-09-24T00:17:18Z"
id: 2004196
url: "https://gang-chen.iteye.com/blog/2004196"
---

【语法】NVL (expr1, expr2)

【功能】若expr1为NULL，返回expr2；expr1不为NULL，返回expr1

【注意】两者的类型要一致，number和varchar的不一致也能用

 

 

【语法】NVL2 (expr1, expr2, expr3) 

【功能】expr1不为NULL，返回expr2；expr2为NULL，返回expr3

【注意】expr2和expr3类型不同的话，expr3会转换为expr2的类型