Pro*C/C++ Programmer's Guide 9.2

Peter Kitson

ISBN : -

Order a printed copy of this book from Amazon --UNAVAILABLE--


Cover Design - Pro*C/C++ Programmer's Guide 9.2
 

For your free electronic copy of this book please verify the numbers below. 

(We need to do this to make sure you're a person and not a malicious script)

Numbers

 




Sample Chapter From Pro*C/C++ Programmer's Guide 9.2
     Copyright © Oracle Corp



What is an Oracle Precompiler?


An Oracle Precompiler is a programming tool that enables the user to embed SQL
statements in a high-level source program. As Figure 1–1 shows, the precompiler
accepts the source program as input, translates the embedded SQL statements into
standard Oracle runtime library calls, and generates a modified source program that
you can compile, link, and execute in the usual way.

Why Use the Oracle Pro*C/C++ Precompiler

The Oracle Pro*C/C++ Precompiler lets you use the power and flexibility of SQL in
your application programs. A convenient, easy to use interface lets your application
access Oracle directly.

Unlike many application development tools, Pro*C/C++ lets 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, Pro*C/C++ helps you fine-tune your applications. It allows close
monitoring of resource use, SQL statement execution, and various runtime indicators.

With this information, you can change program parameters for maximum
performance.

Although precompiling adds a step to the application development process, it saves
time. The precompiler, not you, translates each embedded SQL statement into calls to
the Oracle runtime library (SQLLIB). The Pro*C/C++ precompiler also analyzes host
variables, defines mappings of structures into columns, and, with SQLCHECK=FULL,
performs semantic analysis of the embedded SQL statements.

Why Use SQL

If you want to access and manipulate Oracle data, you need SQL. Whether you use
SQL interactively through SQL*Plus or embedded in an application program depends
on the job at hand. If the job requires the procedural processing power of C or C++, 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
  • CREATE, ALTER, and DROP database tables dynamically
  • SELECT, INSERT, UPDATE, and DELETE rows of data
  • COMMIT or ROLLBACK transactions
Before embedding SQL statements in an application program, you can test them
interactively using SQL*Plus. Usually, only minor changes are required to switch from
interactive to embedded SQL.