안녕하세요.~ 공부하다가 막히고 구글링하다가 막히고 계속 질문을 드리게 되네요..ㅠㅠ
ms sql버전을 oracle sql developer 버전으로 변환하는 작업을 진행하고있습니다.
해당 코드는 이렇습니다.
select
key_seq as visit_concept_id,
person_id as person_id,
case when form_cd in ('02', '04', '06', '07', '10', '12') and in_pat_cors_type in ('11', '21', '31') then 9203 --입원 + 응급
when form_cd in ('02', '04', '06', '07', '10', '12') and in_pat_cors_type not in ('11', '21', '31') then 9201 --입원 + 입원
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type in ('11', '21', '31') then 9203 --외래 + 응급
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type not in ('11', '21', '31') then 9202 --외래 + 외래
else 0
end as visit_concept_id,
convert(date, recu_fr_dt, 112) as visit_start_date,
null as visit_start_time,
case when form_cd in ('02', '04', '06', '07', '10', '12') then DATEADD(DAY, vscn-1, convert(date, recu_fr_dt, 112))
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type in ('11', '21', '31') then DATEADD(DAY, vscn-1, convert(date, recu_fr_dt, 112))
else convert(date, recu_fr_dt, 112)
end as visit_end_date,
null as visit_end_time,
44818517 as visit_type_concept_id,
null as provider_id,
ykiho_id as care_site_id,
key_seq as visit_source_value,
null as visit_source_concept_id
from cohort_cdm.NHID_20T;
1.convert(date 는 to_date() 이렇게 바꿔야 하는걸까요??
2.DATEADD(DAY, vscn-1 이부분은 last_day('yyyymmdd' 이런 형태로 바꾸던데 이렇게 바꾸니 인수의 개수가 부족하다고 뜹니다.(ora-00909 invalid number of arguments)
코딩 고수분들 도움 요청드립니다.
감사합니다.
추가적으로 질문 해도 괜찮을가용?..
select
key_seq as visit_concept_id,
person_id as person_id,
case when form_cd in ('02', '04', '06', '07', '10', '12') and in_pat_cors_type in ('11', '21', '31') then 9203 --입원 + 응급
when form_cd in ('02', '04', '06', '07', '10', '12') and in_pat_cors_type not in ('11', '21', '31') then 9201 --입원 + 입원
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type in ('11', '21', '31') then 9203 --외래 + 응급
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type not in ('11', '21', '31') then 9202 --외래 + 외래
else 0
end as visit_concept_id,
TO_DATE(recu_fr_dt, 112) as visit_start_date,
null as visit_start_time,
case when form_cd in ('02', '04', '06', '07', '10', '12') then TO_DATE(recu_fr_dt, 'yyyymmdd') + vscn - 1
when form_cd in ('03', '05', '08', '09', '11', '13', '20', '21', 'ZZ') and in_pat_cors_type in ('11', '21', '31') then TO_DATE(recu_fr_dt, 'yyyymmdd') + vscn - 1
else TO_DATE(recu_fr_dt, 112)
end as visit_end_date,
null as visit_end_time,
44818517 as visit_type_concept_id,
null as provider_id,
ykiho_id as care_site_id,
key_seq as visit_source_value,
null as visit_source_concept_id
from cohort_cdm.NHID_20T;
null as visit_end_time,
이부분에서 DATE가 필요하지만 NUMBER라고 뜨는데용
구글링해보니 TO_NUMBER를 써주면 된다고하네요.
null as visit_end_time, -> null as to_number(visit_end_time), 이렇게 바꾸었는데용
from키워드가 필요한 위치에 없습니다.
라고 뜨네용
뭐가 잘못된 걸가요?..ㅠㅠ