Chapter 2. Creating and Running PL/SQL Code

Even if they never give a second thought to tasks such as system design or unit testing, all PL/SQL programmers must be familiar with some basic operational tasks:

  • Navigate the database.

  • Create and edit PL/SQL source code.

  • Compile the PL/SQL source code, correcting any code errors (and, optionally, warnings) noted by the compiler.

  • Execute the compiled program from some environment.

  • Examine results of program execution (screen output, changes to tables, etc.).

Unlike standalone languages such as C, PL/SQL is hosted inside an Oracle execution environment (it is an “embedded language”), so there are some unexpected nuances to all of these tasks: some are pleasant surprises; others, consternations. This chapter will show you how to accomplish these tasks at the most basic level (using SQL*Plus), with a brief tour of the nuances sprinkled in. It concludes with some drive-by examples of making calls to PL/SQL from inside several common programming environments such as PHP and C. For more detailed information about compilation and other more advanced tasks, see Chapter 20.

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