Insert value to a table after calculation : Data Insert « PL SQL « Oracle PL / SQL






Insert value to a table after calculation

    

SQL> create table sales(
  2     gift_id number(5),
  3     order_total number(11,2)
  4  );

Table created.

SQL>
SQL> declare
  2     v_order_total sales.order_total%type;
  3  begin
  4     for i in 1..100 loop
  5         v_order_total := i * 1.10;
  6         insert into sales values (i, v_order_total);
  7     end loop;
  8  end;
  9  /

PL/SQL procedure successfully completed.

SQL>
SQL> drop table sales;

Table dropped.

   
    
    
    
  








Related examples in the same category

1.Use in parameter to pass value and insert value to a table
2.Data insert in a procedure
3.Insert data in procedure
4.Insert value passed in by parameter to a table
5.Insert value to product and productcategory with stored procedure
6.Insert value to table with for loop
7.Insert a specified number of suppliers and products per supplier
8.Insert 100000 rows into a table with for loop
9.Loop through all to do a bulk insert
10.An anonymous block program to write the record to a row
11.This script demonstrates returning clause
12.Bulk insert with insert ... select
13.Hard code value and insert