IF((SELECT COUNT(*) FROM IPA_PRCADJ_HDR WHERE TRM_CODE = 41) = 0)
THEN
select '111111' from dual;
ELSE
SELECT '0000000' FROM DUAL;
END IF;
显示错误..
从命令行第73行开始出错:
END IF
ERROR REPORT:
Unknown Command
答案 0 :(得分:4)
你无法建立这样的条件。尝试在select
语句中构建它们,如下所示:
select case
when exists
( select 1
from IPA_PRCADJ_HDR
where TRM_CODE = 41
)
then '111111'
else '0000000'
end
from dual
答案 1 :(得分:-1)
你可以试试这个:
IF NOT EXISTS (SELECT 1 FROM IPA_PRCADJ_HDR)
SELECT '111111' FROM DUAL;
ELSE
SELECT '0000000' FROM DUAL;
答案 2 :(得分:-2)
试试这个
IF((SELECT COUNT(*) FROM IPA_PRCADJ_HDR WHERE TRM_CODE = 41) == 0)
THEN
select '111111' from dual;
ELSE
SELECT '0000000' FROM DUAL;
END IF;
如果你必须使用条件" ==" INSTEAD OF" ="。