Subprograms
A PL/SQL subprogram is a named PL/SQL block that can be invoked
repeatedly. If the subprogram has parameters, their values can differ for each
invocation. PL/SQL has two types of subprograms, procedures and functions. A
function returns a result. For more information about PL/SQL subprograms, see "PL/SQL Subprograms."
PL/SQL also lets you invoke external programs written in other
languages. For more information,
See External Subprograms.
Packages
A package is a schema object that groups logically related PL/SQL types,
variables, constants, subprograms, cursors, and exceptions. A package is
compiled and stored in the database, where many applications can share its
contents. You can think of a package as an application.
You can write your own
packages—for details, see PL/SQL
Packages. You can also use the many
product-specific packages that Oracle supplies. For information about these,
see Oracle
Database PL/SQL Packages and Types Reference.
Triggers
A trigger is a named PL/SQL unit that is stored in the database and run in
response to an event that occurs in the database. You can specify the event,
whether the trigger fires before or after the event, and whether the trigger
runs once for each event or once for each row affected by the event. For
example, you can create a trigger that runs every time an INSERT statement affects the EMPLOYEES table. For more information
about triggers, see PL/SQL Triggers
Input and Output
Most PL/SQL input and output (I/O) is done
with SQL statements that store data in database tables or query those tables.
For information about SQL statements, see
Oracle Database SQL Language Reference. All
other PL/SQL I/O is done with PL/SQL packages those Oracle supplies, which the
Table given below summarizes.
Package
Description
More Information
|
DBMS_OUTPUT Lets PL/SQL blocks, subprograms, Oracle Database PL/SQL
|
Packages and triggers display output. Packages and Types Reference
|
Especially useful for displaying PL/SQL
debugging information. |
HTF Has hypertext functions that generate Oracle Database PL/SQL
|
HTML tags (for example, the HTF.ANCHOR Packages and
Types Reference
|
function generates the HTML anchor ta
|
<A>).
|
HTP Has hypertext procedures that generate Oracle Database PL/SQL
|
HTML tags. Packages and Types Reference
|
Package Description
More Information
|
DBMS_PIPE Lets two or more sessions in the same Oracle Database PL/SQL
|
Instance communicate. Packages and Types Reference
|
UTL_FILE Lets PL/SQL programs read and write Oracle Database PL/SQL
|
operating system files. Packages and Types Reference
|
UTL_HTTP Lets PL/SQL programs make Hypertext Oracle Database PL/SQL
|
Transfer Protocol (HTTP) callouts, and
Packages and Types Reference
|
access data on the Internet over HTTP.
|
UTL_SMTP Sends electronic mails (emails) over Oracle Database PL/SQL
|
Simple Mail Transfer Protocol (SMTP) as Packages and Types Reference
|
Specified by RFC821.
|
To display output passed to DBMS_OUTPUT, you need another program, such as SQL*Plus. To see DBMS_OUTPUT output with SQL*Plus, you must first issue the SQL*Plus command SET SERVEROUTPUT ON. Some subprograms in the packages in can both accept input and display output, but they cannot accept data directly from the keyboard. To accept data directly from the keyboard, use the SQL*Plus commands PROMPT and ACCEPT.
See Also:
■ SQL*Plus User's Guide and Reference for information about the
SQL*Plus command SET SERVEROUTPUT ON
■ SQL*Plus User's Guide and Reference for information about the
SQL*Plus command PROMPT
■ SQL*Plus User's Guide and Reference for information about the
SQL*Plus command ACCEPT
No comments:
Post a Comment