title: Need help filtering user input in PL/SQL by using IF statements
body: <p>I am doing a PL/SQL script that will get input from an user, and then it will find out through an if statement if it has to add data to 1 or 2 tables. I am using IF statements and a WHILE loop to accomplish this task, but it isn't working properly. Also this script it's part of a <a href="https://stackoverflow.com/questions/11869559/how-to-make-a-menu-in-sqlplus-or-pl-sql">main menu</a>. Any input is appreciated it.</p>
  
  <pre><code>-- q3.sql
  -- Question name goes here!!
  
  VARIABLE g_options VARCHAR2(1000);
  
  PROMPT 'Vehicle Inventory Record'
  ACCEPT p_Options PROMPT 'Does this car has any Optional Equipment or Accessories?(YES    or NO)';
  -- Option table
  ACCEPT p_OCode PROMPT 'Enter the code for the option picked (Ex. CD2):'
  ACCEPT p_ODescription PROMPT 'Enter the description for the option picked:'
  ACCEPT p_OPrice PROMPT 'Enter the price for the option picked:'
  -- Car table
  ACCEPT p_SerialNo PROMPT 'What is the serial number of the car?'
  ACCEPT p_Make PROMPT 'What is the make of the car?'
  ACCEPT p_Model PROMPT 'What is the model of the car?'
  ACCEPT p_Year PROMPT 'What is the color of the car?'
  ACCEPT p_Trim PROMPT 'What is the trim of the car?'
  ACCEPT p_PurchFrom PROMPT 'Where was the car purchased from?'
  ACCEPT p_PurchInvNo PROMPT 'What was the invoice number of the purcahse?'
  ACCEPT p_PurchDate PROMPT 'When was the car purcahsed?(ex. 13-FEB-06)'
  ACCEPT p_PurchCost PROMPT 'How much did he car cost?'
  ACCEPT p_ListPrice PROMPT 'What was the list price of the car?'
  
  
  DECLARE
    n_numb number := 1;
  
  BEGIN
    --WHILE  n_numb &lt; 2 LOOP
  
    IF '&amp;p_Options' = 'YES' THEN
    :g_options := 'Input will be added into the option table AND car table';
    -- Insert statement goes here
    n_numb := 2;
  
    ELSIF '&amp;p_Options' = 'NO' THEN
    :g_options := 'Input will only be added to the car table';
    -- Insert statement goes here
    n_numb := 2;
  
    ELSE 
    :g_options := ' The correct input for the first prompt was "YES" or "NO", you entered something else'
    --:g_options :=  :g_options || ' The script will now end, please run it again'
    n_numb := 0;
  
    END IF;
    --END LOOP;
  END;
  /
  </code></pre>
  
  <p>I commented the loop out, and the n_numb variable, and I get this error:</p>
  
  <pre><code>END IF;
    *
  ERROR at line 22:
  ORA-06550: line 22, column 7:
  PLS-00103: Encountered the symbol "END" when expecting one of the following:
  . ( * @ % &amp; = - + ; &lt; / &gt; at in is mod remainder not rem
  &lt;an exponent (**)&gt; &lt;&gt; or != or ~= &gt;= &lt;= &lt;&gt; and or like
  between || multiset member SUBMULTISET_
  The symbol ";" was substituted for "END" to continue.
  </code></pre>
  
  <p><strong>UPDATE 1:</strong> I added the semicolon at the end of the statement, but then I got an error saying that p_Options had to be declared.I just changed p_Options to '&amp;p_Options', and it says that the script ran successfully, BUT I don't see any output. Like:<strong>' The script will now end, please run it again'</strong> .</p>
  
  <p><strong>This is all I see!</strong></p>
  
  <pre><code>old   7:       IF '&amp;p_Options' = 'YES' THEN
  new   7:       IF '' = 'YES' THEN
  old  12:       ELSIF '&amp;p_Options' = 'NO' THEN
  new  12:       ELSIF '' = 'NO' THEN
  
  PL/SQL procedure successfully completed.
  </code></pre>
  
  <p><strong>UPDATE 2:</strong> I got the if statement to work. BUT the loop will not work if I were to type something other than YES or NO as an input. I basically get no return, and I can keep on going pressing enter forever. :S</p>
  
  <p><strong>------------On a different note----------</strong></p>
  
  <p>How do I extract the information that the user/s entered and add it into a table using an INSERT statement? </p>