Database Programming with PL/SQL
8-1:
Creating Procedures
Practice
Activities
Vocabulary
Identify the vocabulary word for each definition below:
Subprograms
Named PL/SQL blocks that are compiled and stored in the
database.
Indicates the DECLARE section of a subprogram.
Anonymous Blocks
Unnamed executable PL/SQL blocks that cannot be reused or
stored in the database for later use.
Procedures
Named PL/SQL blocks that can accept parameters and are
compiled and stored in the database.
Try It / Solve It
1. What is the difference between the following two pieces of code?

2
Code A is an anonymous block which is an unnamed block of code.
-
Is not stored in the database
-
Complied each time it is used
-
Cannot return values
-
Cannot take parameteres
CODE SAMPLE B
CREATE PROCEDURE pay_raise
(p_empid employees employee_id%TYPE,
p_percent_increase
NUMBER)
IS
BEGIN
UPDATE employees
SET salary = (salary * p_percent_increase) + salary
WHERE employee_id = p_empid;
END pay_raise;
Code B is a subprogram named pay_raise.


You've reached the end of your free preview.
Want to read all 5 pages?
- Fall '15
- pieces of code