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

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

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

    隨筆-26  評(píng)論-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 似水流年 閱讀(652) 評(píng)論(0)  編輯  收藏 所屬分類: Oracle
    主站蜘蛛池模板: 免费一级毛片女人图片| 免费成人高清在线视频| 精品久久亚洲一级α| 亚洲AV无码成人专区| 亚洲人成亚洲精品| 亚洲Av综合色区无码专区桃色| 亚洲人成国产精品无码| 国产乱色精品成人免费视频| 国产精品免费观看| 69国产精品视频免费| 18以下岁毛片在免费播放| 伊人久久免费视频| 日韩不卡免费视频| 国产又粗又长又硬免费视频| 国产福利免费在线观看| 亚洲伊人色欲综合网| 亚洲av女电影网| 最新亚洲卡一卡二卡三新区| 亚洲人成无码网站在线观看| 久久精品国产亚洲AV天海翼| 一级特黄aaa大片免费看| 99视频免费在线观看| 无码国产精品一区二区免费3p| 国产va精品免费观看| 亚洲AV无码专区日韩| 亚洲综合婷婷久久| 日韩色视频一区二区三区亚洲| 好湿好大好紧好爽免费视频| 免费观看无遮挡www的小视频| 日韩精品成人亚洲专区| 亚洲综合久久综合激情久久| sihu国产精品永久免费| 真人做A免费观看| 亚洲AV日韩AV天堂一区二区三区| 亚洲熟妇久久精品| 99热在线观看免费| 国产日产成人免费视频在线观看| 亚洲国产成人无码av在线播放| 免费看一区二区三区四区 | 免费国产美女爽到喷出水来视频| 国产av天堂亚洲国产av天堂|