Monday, May 4, 2009

Create Procedure PL/Sql

Procedure does not return a value to the caller.

Usually insert/update/delete operations are placed in a procedure.

A procedure has two parts: the specification and the body. Implementation is placed in the body part.

The following statement creates the procedure insert_visit_log. This is the body of the procedure.

  PROCEDURE insert_visit_log
      (p_visit_no  IN  visit_log.visit_no%TYPE,
       p_aim_code  IN  visit_log.aim_code%TYPE,
       p_op_name   IN  visit_log.op_name%TYPE,
       p_date      IN  visit_log.v_date%TYPE)
   IS
   BEGIN
      INSERT INTO visit_log
             (visit_no,aim_code,op_name,v_date)
      VALUES (p_visit_no, p_aim_code,p_op_name,p_date)
      ;
   END;

Spec of the procedure is :



  PROCEDURE insert_visit_log
      (p_visit_no  IN  visit_log.visit_no%TYPE,
       p_aim_code  IN  visit_log.aim_code%TYPE,
       p_op_name   IN  visit_log.op_name%TYPE,
       p_date      IN  visit_log.v_date%TYPE);

No comments:

Post a Comment