본문 바로가기

IT/DB

[Oracle SQL] 컬럼 추출 입력 예제

 select nvl(sum(decode(mrkt,'N',1,0)),0),
         nvl(sum(decode(mrkt,'N',0,'H',0,1)),0),
         nvl(sum(decode(mrkt,'H',1,0)),0),
         nvl(sum(anum + cnum),0) 
   into n_compcnt,n_occcnt,n_housecnt,n_guestcnt
  from fo_in_res where arrival <= to_date(v_date) and depart > to_date(v_date);