加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ORACLE的LNNVL函数使用

发布时间:2020-12-12 14:13:50 所属栏目:百科 来源:网络整理
导读:LNNVL官方解释 LNNVL provides a concise way to evaluate a condition when one or both operands of the condition may be null. The function can be used only in the WHERE clause of a query. It takes as an argument a condition and returns TRUE i
SQL>createtablexifenfei(namevarchar2(20),yearnumber);Tablecreated.insertintoxifenfeivalues('xifenfei2001',2001);1 row created.'xifenfei2002'1 row created. 'xifenfei2003' 1 row created. 'xifenfei2004' 1 row created. 'xifenfei2005' 1 row created. 'xifenfei2006' 1 row created. 'xifenfei2007' 1 row created. 'xifenfei2008'null); 1 row created. 'xifenfei2009' 1 row created. 'xifenfei2010' 1 row created. 'xifenfei2011' 1 row created. commit; Commitcomplete. select*fromxifenfei; NAMEYEAR -------------------- ---------- xifenfei2001 2001 xifenfei2002 2002 xifenfei2003 2003 xifenfei2004 2004 xifenfei2005 2005 xifenfei2006 2006 xifenfei2007 2007 xifenfei2008 xifenfei2009 2009 xifenfei2010 2010 xifenfei2011 2011 11rowsselected.

几种情况测试说明

--年份小于2009(lnnvl表示年份大于或者2009包含null) wherelnnvl(<2009); YEAR -------------------- ---------- xifenfei2008 xifenfei2009 2009 xifenfei2010 2010 xifenfei2011 2011 --year不为null(lnnvl表示年份为null) yearisnot); YEAR -------------------- ---------- xifenfei2008 --年份为null(lnnvl表示年份不为null) ); YEAR -------------------- ---------- xifenfei2001 2001 xifenfei2002 2002 xifenfei2003 2003 xifenfei2004 2004 xifenfei2005 2005 xifenfei2006 2006 xifenfei2007 2007 xifenfei2009 2009 xifenfei2010 2010 xifenfei2011 2011 10selected. --年份为12345(lnnvl表示年份不为12345) =12345); YEAR -------------------- ---------- xifenfei2001 2001 xifenfei2002 2002 xifenfei2003 2003 xifenfei2004 2004 xifenfei2005 2005 xifenfei2006 2006 xifenfei2007 2007 xifenfei2008 xifenfei2009 2009 xifenfei2010 2010 xifenfei2011 2011 selected. --年份不为12345(lnnvl表示年份为12345或者null) !=12345); YEAR -------------------- ---------- xifenfei2008

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

LNNVL官方解释

LNNVL provides a concise way to evaluate a condition when one or both operands of the condition may be null. The function can be used only in the WHERE clause of a query. It takes as an argument a condition and returns TRUE if the condition is FALSE or UNKNOWN and FALSE if the condition is TRUE. LNNVL can be used anywhere a scalar expression can appear,even in contexts where the IS [NOT] NULL,AND,or OR conditions are not valid but would otherwise be required to account for potential nulls. Oracle Database sometimes uses the LNNVL function internally in this way to rewrite NOT IN conditions as NOT EXISTS conditions. In such cases,output from EXPLAIN PLAN shows this operation in the plan table output. The condition can evaluate any scalar values but cannot be a compound condition containing AND,OR,or BETWEEN.


LNNVL官方解释翻译
lnnvl用于某个语句的where子句中的条件,如果条件为true就返回false;如果条件为UNKNOWN或者false就返回true。该函数不能用于复合条件如AND,or BETWEEN中。

模拟测试环境