7. Controlling Access through Database Procedures : How to Implement a Database Procedure : Database Procedure Example
 
Share this page                  
Database Procedure Example
The following database procedure accepts as input an employee ID number. The employee matching that ID is moved from the employee table and added to the emptrans table.
CREATE PROCEDURE move_emp
   (id INTEGER NOT NULL) AS
BEGIN
   INSERT INTO emptrans
      SELECT * FROM employee
         WHERE id = :id;
   DELETE FROM employee
      WHERE id = :id;
END;