<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
    主站蜘蛛池模板: 亚洲爆乳少妇无码激情| 亚洲а∨天堂久久精品9966| 一区二区三区视频免费观看| 国产成人免费永久播放视频平台 | 国产成人精品免费午夜app| 亚洲AV无码国产丝袜在线观看 | 亚洲午夜国产精品| 亚洲第一成年免费网站| 亚洲最大天堂无码精品区| 午夜无遮挡羞羞漫画免费| 亚洲av无码兔费综合| 亚洲AV中文无码乱人伦| 黄视频在线观看免费| 亚洲国产精品久久久久婷婷软件| 日韩免费人妻AV无码专区蜜桃| 亚洲精品第一国产综合精品| 综合在线免费视频| 亚洲乱人伦中文字幕无码| 国产一区二区三区免费在线观看| a高清免费毛片久久| 亚洲一区二区三区夜色| 曰批全过程免费视频在线观看| 亚洲精品永久在线观看| 亚洲国产精品毛片av不卡在线| 在线观看特色大片免费网站| 亚洲伦理一二三四| 亚洲Av无码乱码在线观看性色| 在线观看免费无码专区| 国产亚洲国产bv网站在线| 免费播放春色aⅴ视频| 亚洲一区免费观看| 国产精品无码亚洲精品2021| 国产精品亚洲成在人线| 国产91色综合久久免费分享| 免费无码又爽又黄又刺激网站| 亚洲一区二区在线免费观看| 国产一级淫片免费播放| 777成影片免费观看| 免费视频精品一区二区| 亚洲高清在线mv| 亚洲国产精品自产在线播放|