我正在尝试为 PLSQL 执行 IF/ELSE 语句,但我不确定我是否以正确的方式执行此操作,因为它总是出现错误:缺少右括号IF (TO_NUMBER(SUBSTR(ATTR_VALUE, 6, 2)) != TO_NUMBER(SUBSTR(ATTR_VALUE, 1, 2))) THEN 但括号对我来说似乎是平衡的。
SELECT *
FROM
(
IF (TO_NUMBER(SUBSTR(ATTR_VALUE, 6, 2)) != TO_NUMBER(SUBSTR(ATTR_VALUE, 1, 2))) THEN
SELECT ID, DATE, ATTR_VALUE, (TO_NUMBER(SUBSTR(ATTR_VALUE, 6, 4))-TO_NUMBER(SUBSTR(ATTR_VALUE, 1, 4))-48) DIFF
ELSE
SELECT ID, DATE, ATTR_VALUE, (TO_NUMBER(SUBSTR(ATTR_VALUE, 6, 4))-TO_NUMBER(SUBSTR(ATTR_VALUE, 1, 4))) DIFF
END IF
FROM Table A
ORDER BY TIME
)
WHERE DIFF>26
请在这个问题上帮助我。