<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
    主站蜘蛛池模板: 国产免费AV片无码永久免费| 亚洲免费二区三区| 国产成人免费ā片在线观看| 亚洲午夜精品一区二区公牛电影院| 免费观看久久精彩视频| 亚洲国产精品无码专区影院| a级毛片免费全部播放| 亚洲精品美女久久777777| 久久九九久精品国产免费直播| 久久亚洲国产精品123区| a级毛片毛片免费观看久潮喷| 亚洲色大成网站www永久一区| 人妻免费一区二区三区最新| 久久精品国产亚洲AV麻豆王友容 | 亚洲日韩国产一区二区三区在线| 成人浮力影院免费看| 亚洲videos| 国产男女猛烈无遮挡免费视频网站 | 香蕉视频在线免费看| 亚洲精品国偷自产在线| 免费无码中文字幕A级毛片| 亚洲黄色在线视频| 成年在线观看免费人视频草莓| 久久久久久久久无码精品亚洲日韩| 免费一级毛片不卡不收费| 成人片黄网站色大片免费观看cn| 亚洲国产精品无码专区影院 | 97无码免费人妻超级碰碰碰碰| 亚洲日本一线产区和二线| 亚洲Av无码乱码在线播放| 久操免费在线观看| 亚洲不卡中文字幕| 五月天婷亚洲天综合网精品偷| 在线观看免费视频网站色| 亚洲乱码日产精品BD在线观看| 国产成人免费ā片在线观看| 国产免费网站看v片在线| 中文字幕在线日亚洲9| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 亚洲欧洲自拍拍偷精品 美利坚| 成人黄网站片免费视频 |