I'm working with PL/SQL Developer.
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.
An example, I have the following table
ORDER_ID   T_NAME   T_PRICE
 20         CAR      50       
 NULL       VAN      100
 NULL       BIKE     10
 NULL       BOAT     300
After running the query I would expect the table to look like:
ORDER_ID   T_NAME   T_PRICE
 20         CAR      50       
 21         VAN      100
 22         BIKE     10
 23         BOAT     300
The query I created so far is:
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;
Oracle doesn't like assigning a value from select statement to the temp_order_id variable.
Does anyone has any idea how to fix it?
 
     
     
     
    