오라클 데이터 유형 체크
DB CAFE
thumb_up 추천메뉴 바로가기
- DBA { Oracle DBA 명령어 > DBA 초급 과정 > DBA 고급 과정 }
- 튜닝 { 오라클 튜닝 목록 }
- 모델링 { 데이터 모델링 가이드 }
- 12c 추가된 기능
1 데이터 유형 Vailidation 체크[편집]
1.1 validate_conversion 함수[편집]
- 체크 유형
- binary_double - binary_float - date - interval day to second - interval year to month - number - timestamp - timestamp with time zone
with tb_a as(
select 1 , '01/01/2016' is_this_a_date from dual
union all select 2 , 'abc' from dual
union all select 3 , '20150101' from dual
union all select 3 , '01-jan-2016' from dual
)
select t.*
from tb_a t
where validate_conversion(is_this_a_date as date) = 1;
1.2 cast 함수[편집]
- 12c 개선
select cast (
'not a date' as date
default date'0001-01-01' on conversion error
) dt
from dual;
-- NLS 에러시
select cast (
'01012010' as date
default '01010001' on conversion error,
'ddmmyyyy'
) dt
from dual;