develog

[Oracle] exists 본문

DB/Oracle

[Oracle] exists

냐옴 2014. 11. 11. 14:25

exists, 서브 쿼리에 결과 행이 있을때만 조건 만족


CASE1

SELECT *

FROM

(

    SELECT 'AA' NM FROM DUAL UNION ALL

    SELECT 'BB' NM FROM DUAL UNION ALL

    SELECT 'CC' NM FROM DUAL

)

WHERE EXISTS

(

    SELECT NULL

    FROM DUAL

    WHERE ROWNUM = 1

)

;


CASE2

SELECT *

FROM

(

    SELECT 'AA' NM FROM DUAL UNION ALL

    SELECT 'BB' NM FROM DUAL UNION ALL

    SELECT 'CC' NM FROM DUAL

)

WHERE EXISTS

(

    SELECT NULL

    FROM DUAL

    WHERE ROWNUM = 0

)

;


'DB > Oracle' 카테고리의 다른 글

[Oracle] USERENV  (0) 2014.12.17
[Oracle] INSERT ALL  (0) 2014.12.08
[Oracle] 컬럼 값이 숫자인지 확인, translate  (0) 2014.10.01
[Oracle] Privileges  (0) 2014.09.02
[Oracle] RAISE_APPLICATION_ERROR  (0) 2014.09.01
Comments