简体   繁体   English

关于Oracle中多个条件的案例陈述

[英]Case Statement on Multiple conditions in Oracle

CASE test
WHEN  NULL and  SUBSTR(('99999999' - Tst_Date),1,4) > 2009 THEN 'Medi'                     
WHEN   NULL and SUBSTR(('99999999' - Tst_Date),1,4) < 2009 THEN 'hills'
ELSE test
END AS "Phy"

Am i missing something in the above case statement? 我在上述案例陈述中遗漏了什么吗? I keep on getting 00905. 00000 - "missing keyword" error? 我一直在收到00905. 00000 - “缺少关键字”错误?

Your syntax is a little bit off. 你的语法有点偏。 Use this: 用这个:

CASE WHEN test IS NULL AND SUBSTR(('99999999' - Tst_Date),1,4) > 2009 THEN 'Medi'
     WHEN test IS NULL AND SUBSTR(('99999999' - Tst_Date),1,4) < 2009 THEN 'hills'
     ELSE test
END AS "Phy"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM