This is a simple sql statement used to print 2 different questions based on the choice entered. I notice that both statements are run even though the else or if condition is not true. The output printed is correct but i dont require the subsitution variable to promt user for entry if the statement is not true.
Thanks for your help people!
SET SERVEROUTPUT ON;
DECLARE
choice number(2) := '&Please_Enter_Choice';
question varchar2(50);
BEGIN
if choice = 1 then
question := '&Whats_your_name?';
else if choice = 2 then
question := '&How_old_are_you?';
END IF;
END IF;
DBMS_OUTPUT.PUT_LINE(QUESTION);
END;
Aucun commentaire:
Enregistrer un commentaire