我需要Oracle v11中CASE
语句的帮助。我的公司使用TRAX Maintenance作为其软件,并使用QuickPrint构建“构建您自己的报告”。我正在尝试做一个小的CASE
语句/函数,但只得到错误消息。任何人都可以帮忙吗?下面是完整的代码(非常简单),结果将返回1列,这是结果。
SELECT "ENGINEERING_ORDER"."EO" AS "EO",
"ENGINEERING_ORDER"."EO_DESCRIPTION" AS "EO_DESCRIPTION",
CASE,
WHEN "ENGINEERING_ORDER"."SCHEDULE_HOURS"=0
AND "ENGINEERING_ORDER"."SCHEDULE_CYCLES"=0 THEN "ENGINEERING_ORDER"."SCHEDULE_DAYS",
WHEN "ENGINEERING_ORDER"."SCHEDULE_HOURS"=0
AND "ENGINEERING_ORDER"."SCHEDULE_DAYS"=0 THEN "ENGINEERING_ORDER"."SCHEDULE_CYCLES",
ELSE "ENGINEERING_ORDER"."SCHEDULE_HOURS",
END
FROM ENGINEERING_ORDER
我得到的错误是:
ORA-00923:未找到FROM关键字
ORA-00936:缺少表达
和其他人取决于您可以执行的其他方式CASE
。
答案 0 :(得分:1)
删除,
和case
之间的所有逗号(end
),它们不应该在那里:
SELECT "ENGINEERING_ORDER"."EO" AS "EO",
"ENGINEERING_ORDER"."EO_DESCRIPTION" AS "EO_DESCRIPTION",
CASE
WHEN "ENGINEERING_ORDER"."SCHEDULE_HOURS"=0
AND "ENGINEERING_ORDER"."SCHEDULE_CYCLES"=0
THEN "ENGINEERING_ORDER"."SCHEDULE_DAYS"
WHEN "ENGINEERING_ORDER"."SCHEDULE_HOURS"=0
AND "ENGINEERING_ORDER"."SCHEDULE_DAYS"=0
THEN "ENGINEERING_ORDER"."SCHEDULE_CYCLES"
ELSE "ENGINEERING_ORDER"."SCHEDULE_HOURS"
END
FROM ENGINEERING_ORDER