본문 바로가기

case1

[Oracle]CASE 조건문 방법1) select case 컬럼값 when 조건 then 출력물 when 조건 then 출력물 when 조건 then 출력물 end from dual; -> case 뒤에 비교할 값을 설정하고 when에 조건을 설정한다. 조건을 충족할 경우에만 then의 값을 가지고 있는다. 방법2) select case when 컬럽값 = 조건 then 출력 when 컬럽값 = 조건 then 출력 else 조건을 만족하지 못할경우 출력 end from dual; -> 조건문을 따로 설정하지 않고 when절에 바로 조건절을 입력한다. 2020. 8. 8.