问题:一下哪几个选项运行完后,屏幕显示"-6502"
提示:VALUE_ERROR定义在STANDARD包里:
VALUE_ERROR EXCEPTION;
PRAGMA EXCEPTION_INIT (VALUE_ERROR, '-6502');
选项1:
DECLARE
l_string VARCHAR2(5);
BEGIN
l_string := '123456';
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (SQLCODE);
END;
/
选项2:
DECLARE
l_number NUMBER := 10;
l_string VARCHAR2(5);
BEGIN
l_string := l_number;
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (sqlcode);
END;
/
选项3:
DECLARE
l_number NUMBER := POWER (10, 5);
l_string VARCHAR2(5);
BEGIN
l_string := l_number;
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (sqlcode);
END;
/
选项4:
DECLARE
l_string VARCHAR2(5) := 'ABC';
l_number NUMBER;
BEGIN
l_number := l_string;
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (sqlcode);
END;
/
选项5:
DECLARE
l_string VARCHAR2(5);
BEGIN
SELECT '1234546' INTO l_string
FROM dual;
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (SQLCODE);
END;
/
选项6:
DECLARE
l_number NUMBER;
l_string VARCHAR2(5) NOT NULL := 'abc';
BEGIN
l_string := l_number;
EXCEPTION
WHEN VALUE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE (SQLCODE);
END;
/