zoukankan      html  css  js  c++  java
  • IsNull Function in PeopleSoft MetaSQL

    In MS SQL Server, sometimes we will use queries like this to avoid the NULL value to be populated

       1: SELECT ISNULL(TABLE1.COLUMN1,'IT IS NULL')
       2: FROM TABLE1

    Similarly, in Oracle Database, we can use this:

       1: SELECT NVL(TABLE1.COLUMN1,'IT IS NULL')
       2: FROM TABLE1

    However, in PeopleSoft Meta-SQL, we shall use the function %COALESCE to do the same thing

       1: SELECT %COALESCE(TABLE1.COLUMN1,'IT IS NULL')
       2: FROM TABLE1

    Below is the syntax explanation from People Book.

    Click to jump to top of pageClick to jump to parent topic
    %COALESCE

    Syntax

    %COALESCE(expr1, expr2, ...)

    Description

    Use the %COALESCE function to return the first non-null argument provided to the function.

    Note. This meta-SQL function is not implemented for COBOL.

    Parameters

    expr1. . .exprn

    Specify the expressions to check.

    Note. You cannot specify bind parameters using these expressions.

    Example

    The following example uses the PRODUCT_INFO table to organize a clearance sale of products. It gives a 10 percent discount to all products with a list price. If there is no list price, the sale price is the minimum price. If there is no minimum price, the sale price is 10.

    SELECT product_id, list_price, min_price, %COALESCE(0.9*list_price, min_price, 10)⇒ "Sale" from PRODUCT_INFO where SUPPLIER_ID = 6009;

  • 相关阅读:
    [haoi2011]向量
    [haoi2008]硬币购物
    noi2001 [食物链]并查集p1697
    [haoi2012]容易题(数论+容斥的思想)
    p1620田忌赛马(贪心+模拟)
    p1368[扑街]广场铺砖
    [zjoi2010]网络扩容
    是时候写一篇总结了
    P1630 求和
    魔术棋子
  • 原文地址:https://www.cnblogs.com/lei1016cn/p/2475964.html
Copyright © 2011-2022 走看看