round((ny.AMOUNT-oy.AMOUNT)/ny.AMOUNT,2)
#之所以做IS NULL 判断是因为ORACLE算术运算符,有一个为NULL,则为NULL
oy.AMOUNT IS NULL
#取TXN_DATE前6个字符
"SUBSTR"(f.TXN_DATE,1,6)
######################
实例:
SELECT( CASE WHEN oy.AMOUNT IS NULL THEN (ny.AMOUNT-0)/ny.AMOUNT WHEN ny.AMOUNT IS NULL THEN (0-oy.AMOUNT)/oy.AMOUNT ELSE round((ny.AMOUNT-oy.AMOUNT)/ny.AMOUNT,2) END) AS samepercent,ny.BLEVEL FROM (SELECT "SUM"(f.AMOUNT) AS AMOUNT,f.BLEVEL FROM FT_INCOME_REPORT_LOG f WHERE "SUBSTR"(f.TXN_DATE,6) >= '201601' AND "SUBSTR"(f.TXN_DATE,6) <= '201605' GROUP BY f.BLEVEL) ny LEFT JOIN (SELECT "SUM"(f.AMOUNT) AS AMOUNT,6) >= '201501' AND "SUBSTR"(f.TXN_DATE,6) <= '201505' GROUP BY f.BLEVEL) oy ON ny.BLEVEL=oy.BLEVEL
错误代码解析:
[Err] ORA-00923
[Err] ORA-00923: 未找到要求的 FROM 关键字
[Err] ORA-00904:
[Err] ORA-00904: "SI"."S_ITEM": 标识符无效
[Err] ORA-0090
[Err] ORA-00907: 缺失右括号
[Err] ORA-00933
##看看是不是sql语句中缺少where,on,and,or,order,group,by等
[Err] ORA-00933: sql 命令未正确结束
[Err] ORA-00972: 标识符过长,看看是不是,字符串少了引号"
oracle 无效的列索引,?占位符与所提供的变量数,不相同
ORA-00918: 未明确定义列 ,看看有没有列名存在相同的 原文链接:https://www.f2er.com/oracle/213052.html