Web applications written in PL/SQL are typically sets of stored procedures that interact with web browsers through the HTTP protocol:
Visiting a web page, following a hypertext link, or pressing a Submit button on an HTML form causes the database server to run a stored procedure.
Any choices that a user makes on an HTML form are passed as parameters to the stored procedure. Parameters can also be hardcoded in the URL used to invoke the stored procedure.
The results of the stored procedure are printed as tagged HTML text and are displayed in the browser as a web page. Web pages generated this way are dynamic: code runs inside
the database server, producing HTML that varies depending on the database contents and the input parameters.
DHTML that would be tedious to produce manually.
The dynamic pages can contain links and HTML forms that call more stored procedures, to drill down or perform some other operation on the displayed data.
The set of interlinked HTML pages forms the user interface of the web application.
There are many techniques for coding dynamic pages, but PL/SQL is especially good for producing dynamic pages based on database processing. Its support for DML statements,
dynamic SQL, cursors, and tight server integration provide both power and flexibility for web applications.
Producing dynamic content using PL/SQL stored procedures gives you the flexibility and interactive behavior of CGI programs, without the memory overhead of forking a new CGI process each time. A typical stored procedure might print some header information, issue a query, and loop through the result set to format the data in an HTML list or table.
This program flow is very similar to a Perl script that operates on a text file.