본문 바로가기
개발

오라클은 빈문자열을 지원하지 않는다.

by 플리트우드 2025. 9. 26.

https://stackoverflow.com/questions/26274750/oracle-nvl-with-empty-string

 

Oracle NVL with empty string

I have this table where NULL is the NULL value, not the string NULL: MYCOL -------- NULL example Why does this query not return the NULL row? select * from example_so where nvl(mycol, '') = '';

stackoverflow.com

 

 

 

1. where clause에서 nvl(컬럼명, '') <> '비교값' 을 썼는데 해당 컬럼이 null인 레코드가 안 나온다.

응?? 난 null인 것도 필요하단 말이다 

 

2. 바쁘다~ 걍 (컬럼명 is null or 컬럼명 <> '비교값') 으로 간다.

 

3. (안바쁨) 생각해보니까 안되는게 이상하다.

 

4. nvl(컬럼명, '1') <> '비교값'  을 테스트해보니  null인 것도 나온다.

어허 빈문자열을 null로 간주하는구만... 난 쓰나마나한 nvl을 작성한 것이었따.