8.3. Server-Side PL/SQL

As mentioned at the beginning of this chapter and throughout this book, PL/SQL is the procedural language used in the Oracle database, and the applications you create with APEX are materialized with PL/SQL code. This code can be thought of as application-side code, in that the code responds to application side interactions.

However, you can also use PL/SQL code to implement triggers, which respond to database activities. A trigger is fired when the data is inserted, updated, or deleted from the database, and triggers fire either before or after these events.

The Oracle database also supports INSTEAD OF triggers, which, as their name implies, are used instead of database actions. This type of trigger is used less commonly than INSERT, UPDATE, and DELETE triggers, and are beyond the scope of this book.

If you are a developer, you are probably already familiar with the distinction between application code and server code, but the distinction between PL/SQL in APEX and in the database is a little less clear. For instance, application code typically runs on a client machine, while PL/SQL application code used by APEX still runs in the Oracle database. And PL/SQL code that runs as part of an APEX application has a slightly different syntax than PL/SQL database triggers, as you will soon see.

But there are still times when it makes more sense to use database triggers than PL/SQL APEX triggers.

8.3.1. Problem Statement and Solution Location

You have already ...

Get Beginning Oracle® Application Express now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.