When I run my script, I enter N when it asks "Will the payment method be cash (Y/N)?" but it still executes the statements under the IF...Why is this happening?
ACCEPT ExpNum NUMBER PROMPT 'Enter an expense number: ';
SELECT *
FROM ExpByCC
WHERE ExpNum = &ExpNum;
SELECT IsCash,CashAmt
FROM EXPMAST
WHERE ExpNum = &ExpNum
AND IsCash = 'Y';
ACCEPT CashChoice PROMPT 'Will the payment method be cash (Y/N)? ';
DECLARE
ChoiceCash VARCHAR2(1);
NumRowInExpByCC NUMBER;
BEGIN
ChoiceCash := &CashChoice;
IF ChoiceCash = 'Y'
THEN
UPDATE EXPMAST
SET IsCash = ChoiceCash,
CashAmt = &CashAmount
WHERE ExpNum = &ExpNum;
COMMIT;
ELSE
&CType;
&CCnum;
&Amt;
END IF;
END;
/