title: Can I use if statements in a stored procedure to insert values into a table?
body: <p>I am trying to write a stored procedure that selects indiv_ids and transaction_ids and inserts these into a table on my schema. In doing so, I want to pass in variables and have the stored procedure use if statements to select the indiv_ids and transaction_ids from different tables depending on the information passed in. I've tried a few variations and can't get the procedure to work without an error. Thanks!</p>
  
  <pre><code> create or replace procedure myproc (name_type in varchar2, dept in number)
   is begin 
   if name_type='promo' then insert into mytable(indiv_id,transaction_id)
   ---sql here; 
   commit;
   elsif name_type='deal' then insert into mytable(indiv_id, transaction_id)
   ---sql here;
   commit;
   end if;
   end;
  
  
   errors: Error(8,10): PL/SQL: SQL Statement ignored, 
           Error(16,31): PL/SQL:  ORA-00942: table or view does not exist
  </code></pre>