Workkkkk
Workkkkk

Reputation: 285

bind variable "C_NUM" not declared

I don't know why I'm getting this error bind variable "C_NUM" not declared. I'm not sure if I'm not declaring it correctly or if I'm misusing it in the if statement.

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;
/

Upvotes: 0

Views: 249

Answers (1)

Jaydip Rakholiya
Jaydip Rakholiya

Reputation: 802

If should be -

IF c_num = '704B' THEN

Upvotes: 1

Related Questions