안녕하세요.. 아래와 같은 산식이 잇을때 저 산식에서 결과값이 True(1) 인지 false(0) 인지 결과값을 어떤 방식이던 Return 받고 싶은데 간단하게 처리할 수 있는 방법이 없나요
도움 부탁드립니다....
1번 예) 13>1 and 2=2 or 3=4
2번 예) 13>1 and (2=2 or 3=4)
참고하세요
WITH test AS
(
SELECT '3+4' col FROM DUAL
)
SELECT TO_NUMBER ( dbms_xmlgen.getxmltype ( 'SELECT ' || col || ' a FROM DUAL' ).extract('//text()') ) cal
FROM test a
SELECT CASE WHEN ( 산식 ) THEN 1 ELSE 0 END FROM DUAL;
WITH t AS ( SELECT '13>1 and 2=2 or 3=4' x FROM dual UNION ALL SELECT '13>1 and (2=2 or 3=4)' FROM dual UNION ALL SELECT '13<1 and (2=3 or 3=4)' FROM dual ) SELECT x , dbms_xmlgen.getxmltype( 'SELECT NVL(MIN(1), 0) FROM dual WHERE '||x ).Extract('//text()') AS y FROM t ;
WITH t AS
SELECT '13>1 and 2=2 or 3=4' x FROM dual
UNION ALL SELECT '13>1 and (2=2 or 3=4)' FROM dual
UNION ALL SELECT '13<1 and (2=3 or 3=4)' FROM dual
SELECT x
, dbms_xmlgen.getxmltype(
'SELECT CASE WHEN '||x||' THEN 1 ELSE 0 END FROM dual').Extract('//text()') AS y
FROM t
;