Tham khảo tài liệu 'oracle pl/sql for dummies phần 3', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 70 Part II Getting Started with PL SQL and store them in the database. Packages allow you to place those functions and procedures in a container that helps manage all the program units. A large system may contain hundreds or even thousands of functions and procedures. By using packages you can place these program units into logical groups. For example because you know that both the previously created procedure and function will be used in the same application module named TEST1 you can create the following package by using the CREATE OR REPLACE PACKAGE command create or replace package pkg testl as function f_getArea_Nr i_rad_nr NUMBER return NUMBER procedure p print i_str1_tx VARCHAR2 hello i_str2_tx VARCHAR2 world i_end_tx VARCHAR2 end create or replace package body pkg_test1 as function f_getArea_Nr i_rad_nr NUMBER return NUMBER is v_pi_nr NUMBER begin return v_pi_nr i_rad_nr 2 end procedure p_print i_str1_tx VARCHAR2 hello i_str2_tx VARCHAR2 world i_end_tx VARCHAR2 is begin i_str1_tx i_str2_tx i_end_tx end end Notice how you created two database objects a package usually called the package specification or just spec for short and a package body. The spec contains only the function header. This is the visible part of the function and contains all the information that any code accessing the function needs to know the function name its parameters and its return type . The actual function code is placed in the package body. You can find out more about using packages and package features in Chapter 7. Chapter 3 Laying the Groundwork PL SQL Fundamentals 71 Triggers Another way to store PL SQL code in the database is by using a trigger. By definition a trigger is a procedure stored in the database and implicitly run or fired when something happens. Depending upon the version of Oracle you re using different events may fire a trigger but these events are always divided into three groups DML triggers INSTEAD OF triggers and system event .