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

          In Oracle/PLSQL, the coalesce function returns the first non-null expression in the list. If all expressions evaluate to null, then the coalesce function will return null.

          The syntax for the coalesce function is:

          coalesce( expr1, expr2, ... expr_n )


          For Example:

          You could use the coalesce function in an SQL statement as follows:

          SELECT coalesce( address1, address2, address3 ) result
          FROM suppliers;


          The above coalesce statement is equivalent to the following IF-THEN-ELSE statement:

          IF address1 is not null THEN
          ???? result := address1;

          ELSIF address2 is not null THEN
          ??? result := address2;

          ELSIF address3 is not null THEN
          ??? result := address3;

          ELSE
          ??? result := null;

          END IF;


          The coalesce function will compare each value, one by one.

          posted on 2006-04-04 10:15 似水流年 閱讀(425) 評論(0)  編輯  收藏 所屬分類: Oracle
          主站蜘蛛池模板: 通河县| 曲沃县| 揭东县| 临江市| 梁平县| 汾西县| 明水县| 白河县| 军事| 泸溪县| 延安市| 富宁县| 阳泉市| 专栏| 玉屏| 敖汉旗| 台北县| 朝阳市| 武威市| 延长县| 株洲县| 平原县| 井陉县| 沐川县| 卢龙县| 十堰市| 社会| 信宜市| 香港| 巴彦县| 犍为县| 天气| 牡丹江市| 汉源县| 青海省| 泸州市| 吉木乃县| 阜城县| 阿拉善左旗| 灌阳县| 泸溪县|