title: Create stored procedure to add new column based on other column in table (Oracle SQL)
body: <p>I'm new to SQL and attempting to write a stored procedure that will do two things. </p>
  
  <ol>
  <li>Add a new column to a previously-created table.</li>
  <li>Populate this new column with data based on another column in the table.</li>
  </ol>
  
  <p>I can get it to add the column, it's part two where I'm really having trouble.</p>
  
  <p>Basically, I don't understand how to say, "If the value in this slot is higher than x, alter the value to this. Otherwise, alter the value to this." </p>
  
  <p>I could do this in any other language, but SQL just doesn't resonate well with me. </p>
  
  <p>Below is basically what I'm trying to create. The first two lines work, sort of. I didn't know how to say, "Read from this column, do the check, then put the discounted value into the new column." My thought was to copy the values from the other column into my new one, then alter it from there. </p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE ProductLineSale
  AS
  BEGIN
      EXECUTE IMMEDIATE 'ALTER TABLE Product ADD SalePrice DECIMAL (6,2)';
      EXECUTE IMMEDIATE 'UPDATE Product SET SalePrice = ProductStandardPrice';
  
      IF SalePrice &gt;= 400 THEN
          SalePrice := SalePrice*.85;
      ELSE
          SalePrice := SalePrice*.90;
      END IF;
  END;
  </code></pre>