참고 : http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/controlstructures.htm#sthref976
* NULL Statement:
You can use the NULL statement to indicate that you are aware of a possibility,
but no action is necessary.
EXCEPTION
WHEN ZERO_DIVIDE THEN
ROLLBACK;
WHEN OTHERS THEN
NULL;
END;
* 문제) 아래 블럭은 에러가 발생한다. 해결 방법은?
DECLARE
done BOOLEAN;
BEGIN
FOR i IN 1..50 LOOP
IF done THEN
GOTO end_loop;
END IF;
<<end_loop>> -- not allowed unless an executable statement follows
END LOOP; -- raises an error without the previous NULL
END;
/
↓ ↓ ↓
DECLARE
done BOOLEAN;
BEGIN
FOR i IN 1..50 LOOP
IF done THEN
GOTO end_loop;
END IF;
<<end_loop>> -- not allowed unless an executable statement follows
NULL; -- add NULL statement to make label legal and fix the error
END LOOP; -- raises an error without the previous NULL
END;
/
'Oracle > PL/SQL' 카테고리의 다른 글
15일차 # 6-3: Composite Data Types (0) | 2012.04.24 |
---|---|
15일차 # 확인문제 (0) | 2012.04.24 |
15일차 # 5-27: Nested Loop and Label (0) | 2012.04.24 |
15일차 # 5-22: FOR Loop (0) | 2012.04.24 |
15일차 # 5-20: WHILE Loop (0) | 2012.04.24 |