Chapter 2. Creating and Running PL/SQL Code

Before exploring the “meat and potatoes” of writing PL/SQL programs, let’s review some practical information about how to create, compile, and run those programs. This chapter provides a PL/SQL-focused crash course on the Oracle tool known as SQL*Plus ; it also breezes through a few samples of PL/SQL embedded in some other languages. If you already use SQL*Plus, or one of the third-party tools such as Toad for Oracle, you can skip most of this chapter. However, you might still enjoy reading the section "Calling PL/SQL From Other Languages" near the end of the chapter.

As is true for SQL, PL/SQL programs can be invoked from a variety of other languages. Unlike SQL, PL/SQL can actually run in two different places:

  • Inside the Oracle database server, as stored code. If you call PL/SQL from SQL*Plus, Java, or any other language, this is typically where it’s going to run.

  • In one of Oracle’s application environments such as Oracle Forms or Oracle Reports, as a program that executes on a client computer. Often, the runtime environment lives on a middle tier, operated across the network from a browser-only or “thin” client.

Because this is a book about PL/SQL programming on the server, we are not going to spend much time on Oracle Forms or Oracle Reports. Instead, we will concentrate on the common aspects of PL/SQL programming; one of the most common denominators of Oracle programming is SQL*Plus.

SQL*Plus

The granddaddy of Oracle front ends, ...

Get Oracle PL/SQL Programming, 4th Edition 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.