Database Reference
In-Depth Information
Figure 24.4
Executing Triggers
from DML
Commands.
/
SET SERVEROUTPUT ON;
INSERT INTO ARTIST(ARTIST_ID,NAME)
VALUES(100,'Robert Alan Zimmerman');
UPDATE ARTIST SET NAME='Bob Dylan'
WHERE NAME='Robert Alan Zimmerman';
DELETE FROM ARTIST WHERE NAME='Bob Dylan';
SET SERVEROUTPUT OFF;
24.2.2.4
Using Packages
Packages can be used to group commonly stored PL/SQL units into a single
chunk of code. A package must have a declaration section and a body sec-
tion. The declaration simply defines named units within the package, and
the package body contains the actual procedures. The following script is a
simple package converting temperatures between degrees Fahrenheit (F˚),
degrees Celsius (C˚), and degrees Kelvin (K˚). Example executions of the
various functions are shown in Figure 24.5.
CREATE OR REPLACE PACKAGE TEMPERATURE AS
FUNCTION cTOf(c VARCHAR2 DEFAULT 0) RETURN VARCHAR2;
FUNCTION fTOc(f VARCHAR2 DEFAULT 0) RETURN VARCHAR2;
 
Search WWH ::




Custom Search