전체 글
-
-
ORACLE CASE WHEN (IF문) 사용 방법DEV/database 2023. 11. 14. 14:59
-- 기본적인 ORACLE CASE 문법 CASE WHEN [조건문1] THEN ( [조회문1] ) WHEN [조건문2] THEN ( [조회문2] ) WHEN [조건문3] THEN ( [조회문3] ) END -- 사용법 예시 -- EX) SELECT A.SAMPLE_ID , CASE WHEN A.SAMPLE_DIV_CD = '001' THEN ( SELECT B.SAMPLE_CD FROM SMAPLE_CD_TABLE B WHERE B.SAMPLE_DIV_CD = '001' ) WHEN A.SAMPLE_DIV_CD = '002' THEN ( SELECT B.SAMPLE_CD FROM SMAPLE_CD_TABLE B WHERE B.SAMPLE_DIV_CD = '002' ) WHEN A.SAMPLE_DIV_C..