<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-26  評論-13  文章-46  trackbacks-0

    In Oracle/PLSQL, the NVL function lets you substitute a value when a null value is encountered.

    The syntax for the NVL function is:

    NVL( string1, replace_with )

    string1 is the string to test for a null value.

    replace_with is the value returned if string1 is null.


    Example #1:

    select NVL(supplier_city, 'n/a')
    from suppliers;

    The SQL statement above would return 'n/a' if the supplier_city field contained a null value. Otherwise, it would return the supplier_city value.


    Example #2:

    select supplier_id,
    NVL(supplier_desc, supplier_name)
    from suppliers;

    This SQL statement would return the supplier_name field if the supplier_desc contained a null value. Otherwise, it would return the supplier_desc.


    Example #3:

    select NVL(commission, 0)
    from sales;

    This SQL statement would return 0 if the commission field contained a null value. Otherwise, it would return the commission field.


    Frequently Asked Questions


    Question:? I tried to use the NVL function through VB to access Oracle DB.

    To be precise,

    select NVL(DIstinct (emp_name),'AAA'),................ from.................

    I got an oracle error when I use distinct clause with NVL, but when I remove distinct it works fine.

    Answer:? It is possible to the use the DISTINCT clause with the NVL function. However, the DISTINCT must come before the use of the NVL function. For example:

    select distinct NVL(emp_name, 'AAA')
    from employees;

    Hope this helps!


    Question:? Is it possible to use the NVL function with more than one column with the same function call?? To be clear, if i need to apply this NVL function to more than one column like this:

    NVL(column1;column2 ...... , here is the default value for all )

    Answer:? You will need to make separate NVL function calls for each column. For example:

    select NVL(table_name, 'not found'), NVL(owner, 'not found')
    from all_tables;

    posted on 2006-04-05 13:38 似水流年 閱讀(646) 評論(0)  編輯  收藏 所屬分類: Oracle
    主站蜘蛛池模板: 亚洲日本一区二区三区在线| 国产情侣激情在线视频免费看| 国产V亚洲V天堂无码久久久| 精品亚洲成a人在线观看| 成人免费毛片观看| 亚洲GV天堂GV无码男同| www.av在线免费观看| 亚洲AV成人潮喷综合网| 亚洲成人免费电影| 两个人看www免费视频| 亚洲欧洲精品无码AV| 久久精品国产免费一区| 亚洲AV无码国产精品麻豆天美| 免费国产午夜高清在线视频 | 亚洲国产婷婷综合在线精品 | 免费吃奶摸下激烈视频| 国产99久久久国产精免费| 亚洲av永久无码制服河南实里| 国产精品白浆在线观看免费 | 亚洲人成人77777网站不卡| 国产精品成人免费一区二区 | 91香蕉在线观看免费高清| 亚洲一级毛片免费看| 日日操夜夜操免费视频| 亚洲乱码一二三四区麻豆| 午夜视频免费成人| 污污污视频在线免费观看| 亚洲αv在线精品糸列| 成人福利免费视频| 羞羞的视频在线免费观看| 在线精品亚洲一区二区小说| 一级特黄aa毛片免费观看| 亚洲综合激情五月色一区| 亚洲国产精品专区在线观看| 午夜无码A级毛片免费视频| 亚洲人成无码网站在线观看| 久久影视综合亚洲| 青苹果乐园免费高清在线| 国产福利免费视频 | 久久夜色精品国产亚洲av| 4399好看日本在线电影免费|