round((ny.AMOUNT-oy.AMOUNT)/ny.AMOUNT,2)
#The reason for doing IS NULL judgment is because of the ORACLE arithmetic operator, if one is NULL, it is NULL
oy.AMOUNT IS NULL
# Take the first 6 characters of TXN_DATE
"SUBSTR"(f.TXN_DATE,1,6)
########################
Examples:
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,1,6) >= '201601' AND "SUBSTR"(f.TXN_DATE,1,6) <= '201605' GROUP BY f.BLEVEL) ny LEFT JOIN (SELECT "SUM"(f.AMOUNT) AS AMOUNT,f.BLEVEL FROM FT_INCOME_REPORT_LOG f WHERE "SUBSTR"(f.TXN_DATE,1,6) >= '201501' AND "SUBSTR"(f.TXN_DATE,1,6) <= '201505' GROUP BY f.BLEVEL) oy ON ny.BLEVEL = oy.BLEVEL
Error code resolution:
[Err] ORA-00923
[Err] ORA-00923: requested FROM keyword not found
[Err] ORA-00904:
[Err] ORA-00904: "SI"."S_ITEM": invalid identifier
[ Err] ORA-0090
[Err] ORA-00907: missing closing parenthesis
[Err] ORA-00933
##See if the SQL statement is missing where, on, and, or, order, group, by, etc.
[Err] ORA- 00933: SQL command did not end correctly
[Err] ORA-00972: Identifier is too long, see if the string is missing quotes"
oracle invalid column index , ? placeholder is not the same as the number of variables provided
ORA -00918: The column is not clearly defined , see if there is a column with the same name