我不知道为什么我没有声明此错误绑定变量“ C_NUM”。我不确定是否未正确声明它,或者是否在if语句中滥用了它。
SET SERVEROUTPUT ON
DECLARE
sentence VARCHAR2(40);
num NUMBER(8,2);
c_num CONSTANT VARCHAR2 := '704B';
t_f BOOLEAN;
next_week DATE := SYSDATE + 7;
BEGIN
DBMS_OUTPUT.PUT_LINE('Constant:'|| c_num);
DBMS_OUTPUT.PUT_LINE('Date:'|| next_week);
If :sentence = 'SQL' Then
DBMS_OUTPUT.PUT_LINE('Course:'|| sentence);
ELSE
IF :c_num = '704B' THEN
IF sentence IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('Course Name:'|| sentence);
DBMS_OUTPUT.PUT_LINE('Room Name:'|| c_num);
ELSE
DBMS_OUTPUT.PUT_LINE('Course is unknown');
DBMS_OUTPUT.PUT_LINE('Room Name:'|| c_num);
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('Course us unknown');
END IF;
END IF;
END;
/
答案 0 :(得分:1)
如果应该-
IF c_num = '704B' THEN