|Programmer's Guide to the Oracle Precompilers
Part Number A42525-1
This chapter introduces you to the Oracle Precompilers. You look at their role in developing application programs that manipulate Oracle data and find out what they allow your applications to do. The following questions are answered:
An Oracle Precompiler is a programming tool that allows you to embed SQL statements in a high-level host program. As Figure 1 - 1 shows, the precompiler accepts the host program as input, translates the embedded SQL statements into standard Oracle runtime library calls, and generates a source program that you can compile, link, and execute in the usual way.
Text description of the illustration image002.gif. Figure 1 - 1. Embedded SQL Program Development
Meant for different application areas and reflecting different design philosophies, these languages offer a broad range of programming solutions.
Attention: This guide is supplemented by companion books devoted to COBOL and FORTRAN. Refer to the Programmer's Guide to the Pro*Ada Precompiler and Programmer's Guide to the Oracle Pro*C/C++ Precompiler, respectively, for complete descriptions of the Pro*Ada and Pro*C/C++ Precompilers.
Pro*Pascal and Pro*PL/I are in "maintenence mode," which means that Version 1 of these products will not be enhanced with any additional features beyond those included with Release 1.6. However, Oracle will continue to issue patch releases -- release numbers 1.6.x -- as bugs are reported and corrected.
The Oracle Precompilers let you pack the power and flexibility of SQL into your application programs. You can use SQL in popular high-level languages such as COBOL and FORTRAN. A convenient, easy to use interface lets your application access Oracle directly.
Unlike many application development tools, the Oracle Precompilers let you create highly customized applications. For example, you can create user interfaces that incorporate the latest windowing and mouse technology. You can also create applications that run in the background without the need for user interaction.
Furthermore, with the Oracle Precompilers you can fine-tune your applications. They allow close monitoring of resource usage, SQL statement execution, and various runtime indicators. With this information, you can adjust program parameters for maximum performance.
If you want to access and manipulate Oracle data, you need SQL. Whether you use SQL interactively or embedded in an application program depends on the job at hand. If the job requires the procedural processing power of COBOL or FORTRAN, or must be done on a regular basis, use embedded SQL.
SQL has become the database language of choice because it is flexible, powerful, and easy to learn. Being non-procedural, it lets you specify what you want done without specifying how to do it. A few English-like statements make it easy to manipulate Oracle data one row or many rows at a time.
You can execute any SQL (not SQL*Plus) statement from an application program. For example, you can
Before embedding SQL statements in an application program, you can test them interactively using SQL*Plus or Server Manager. Usually, only minor changes are required to switch from interactive to embedded SQL.
An extension to SQL, PL/SQL is a transaction processing language that supports procedural constructs, variable declarations, and robust error handling. Within the same PL/SQL block, you can use SQL and all the PL/SQL extensions.
The main advantage of embedded PL/SQL is better performance. Unlike SQL, PL/SQL allows you to group SQL statements logically and send them to Oracle in a block rather than one by one. This reduces network traffic and processing overhead.
For more information about PL/SQL including how to embed it in an application program, see Chapter 5, "Using Embedded PL/SQL."
As Figure 1 - 2 shows, the Oracle Precompilers offer many features and benefits that help you to develop effective, reliable applications.
Text description of the illustration image003.gif. Figure 1 - 2. Features and Benefits
For example, the Oracle Precompilers allow you to
To sum it up, the Oracle Precompilers are full-featured tools that support a professional approach to embedded SQL programming.
SQL has become the standard language for relational database management systems. This section describes how the Oracle Precompilers conform to the latest SQL standards established by the following organizations:
Those organizations have adopted SQL as defined in the following publications:
ANSI X3.168-1992 specifies the syntax and semantics for embedding SQL statements in application programs written in a standard programming language such as COBOL, FORTRAN, Pascal, or PL/I.
ISO/IEC 9075-1992 fully adopts the ANSI standards.
FIPS PUB 127-2, which applies to RDBMS software acquired for federal use, also adopts the ANSI standards. In addition, it specifies minimum sizing parameters for database constructs and requires a "FIPS Flagger" to identify ANSI extensions.
For copies of the ANSI standards, write to
For a copy of the ISO standard, write to the national standards office of any ISO participant. For a copy of the NIST standard, write to
Under Oracle7, the Oracle Precompilers comply 100% with the ANSI, ISO, and NIST standards. As required, they support Entry SQL and provide a FIPS Flagger.
According to FIPS PUB 127-1, "an implementation that provides additional facilities not specified by this standard shall also provide an option to flag nonconforming SQL language or conforming SQL language that may be processed in a nonconforming manner." To meet this requirement, the Oracle Precompilers provide the FIPS Flagger, which flags ANSI extensions. An extension is any SQL element that violates ANSI format or syntax rules, except privilege enforcement rules. For a list of Oracle extensions to standard SQL, see the Oracle7 Server SQL Reference.
You can use the FIPS Flagger to identify
Thus, the FIPS Flagger helps you develop portable applications.
An option named FIPS governs the FIPS Flagger. To enable the FIPS Flagger, you specify FIPS=YES inline or on the command line. For more information about the command-line option FIPS, see page 6 - 19.
NIST tested the Oracle Precompilers for ANSI Entry SQL compliance using the SQL Test Suite, which consists of nearly 300 test programs. Specifically, the programs tested for conformance to the COBOL and FORTRAN embedded SQL standards. As a result, the Oracle Precompilers were certified 100% ANSI-compliant.
For more information about the tests, write to