回覆列表
  • 1 # 使用者5131253402538

    1, deocde 與 case when 的作用相同,用於不同條件分支的不同處理。於case when 相比只是用法不同。同樣可以巢狀和滿足多個值。

    2,多個值

    decode(name, "Wang", "001", "Li", "002", "003")

    相當於

    case

    when name = "Wang"

    then "001"

    when name = "Li"

    then "002"

    else "003"

    end

    3, 巢狀

    decode(name, "Wang", decode(sno, "001", "Yes", ""), "Li", decode(sno,"002","Yes",""), decode(sno, "003","Yes",""))

    相當於

    case

    when name = "Wang"

    then case

    when sno="001"

    then "Yes"

    else ""

    end

    when name="Li"

    then case

    when sno="002"

    then "Yes"

    else ""

    end

    else case

    when sno="003"

    then "Yes"

    else ""

    end

    end

  • 中秋節和大豐收的關聯?
  • 簡答:如何理解資本主義生產過程是勞動過程和價值增殖過程的統一?