3. Statements : OpenROAD SQL Statements : Insert Statement : Examples—Insert Statement
 
Share this page                  
Examples—Insert Statement
Insert the values of projname and enddate into the projects table and then commit the changes:
insert into projects(name, duedate)
     values(:projname, :enddate);
commit;
Insert a computed value into the personnel table:
repeated insert into personnel(name, sal)
     values(:name, :salary*1.1);
Insert data from the contractor table into the personnel table, according to qualifying criteria, then commit the changes:
repeated insert into personnel(name, sal)
     select name, salary from contractor
          where name = :f_name and age = :f_age;
commit;
Take the rows from the emptable array and insert them into the database:
i = 1;
while i <= emptable.LastRow do
     repeated insert into employee(name, age, salary)
          values(:emptable[i].name,
               :emptable[i].age,
               :emptable[i].salary);
     i = i + 1;
endwhile;