隨筆-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 似水流年 閱讀(424) 評論(0)  編輯  收藏 所屬分類: Oracle
          主站蜘蛛池模板: 聊城市| 惠州市| 彰武县| 三河市| 河北省| 喀喇沁旗| 五家渠市| 邢台市| 定边县| 怀仁县| 沁源县| 广水市| 都江堰市| 陈巴尔虎旗| 综艺| 岫岩| 浙江省| 玉树县| 军事| 文化| 尼玛县| 西林县| 芦溪县| 常熟市| 民乐县| 庄浪县| 乐业县| 榆中县| 娄底市| 建宁县| 河东区| 封开县| 永清县| 宁德市| 延川县| 烟台市| 武鸣县| 海兴县| 彰武县| 荔波县| 鄂托克前旗|