title: How to assign a value to variable from select statement (PL/SQL Developer)
body: <p>I'm working with PL/SQL Developer.</p>
  
  <p>I'm trying to update values in a column(existing table).
  The values used to populate rows should be auto incremented. The starting value is the maximum value that already exist in such field.</p>
  
  <p>An example, I have the following table</p>
  
  <pre><code>ORDER_ID   T_NAME   T_PRICE
   20         CAR      50       
   NULL       VAN      100
   NULL       BIKE     10
   NULL       BOAT     300
  </code></pre>
  
  <p>After running the query I would expect the table to look like:</p>
  
  <pre><code>ORDER_ID   T_NAME   T_PRICE
   20         CAR      50       
   21         VAN      100
   22         BIKE     10
   23         BOAT     300
  </code></pre>
  
  <p>The query I created so far is:</p>
  
  <pre><code>DECLARE
    temp_order_id number;
  
  BEGIN
    :temp_order_id = SELECT ISNULL(MAX((ORDER_ID)),0) + 1 FROM SALES_ACC;
  update SALES_ACC
  set (ORDER_ID)  = :temp_order_id , :temp_order_id = :temp_order_id + 1
  where (ORDER_ID) is null;
  END;
  </code></pre>
  
  <p>Oracle doesn't like assigning a value from select statement to the temp_order_id variable.</p>
  
  <p>Does anyone has any idea how to fix it?</p>