[ Oracle - Procedure 함수_NULL ]
1. IF 문에서 NULL 비교 방법
* Oracle 에서는 '' 도 null 이고, null 도 null 이다.
정상 :
1. if :n.deptno is not null then
2. if nvl(:new.qty_do,0) != 0 then
3. if nvl(:new.qty_do,0) != 0 then
오류 :
1. if :n.deptno = null then ..
pl-sql에서는 위와 같이 하면 null 이라고 비교가 되지 않는다.(즉, null 이여도 null 로 인식 하지 않는다). 물론 Error 도 없고. )
2. DECLARE sYYMM char(5); -- 라고 정의 를 하면
..
Script에서는 sYYMM = '' 이것도 아니고, sYYMM is Null 도 아니고
sYYMM = ' ' 이다. (즉, space 한 칸으로 들어간다.)
'(DB) Oracle > PL.SQL' 카테고리의 다른 글
Oracle - Procedure 값_시스템변수 (0) | 2017.01.21 |
---|---|
Oracle - Procedure 함수_NULLIF.COALESCE (0) | 2017.01.21 |
Oracle - Procedure BULK BIND(BULK COLLECT INTO문) (0) | 2017.01.21 |
Oracle - Procedure 문법_FOR_SELECT문 (0) | 2017.01.21 |
Oracle - Procedure 문법_Cursor_SubQuery (0) | 2017.01.21 |