Programmer's Guide to the Pro*C/C++ Precompiler
Library
Product
Programmer's Guide to the Oracle
®
Pro*C/C++
(tm)
Precompiler
Preface
What This Guide Has to Offer
Who Should Read This Guide?
How the Pro*C/C++ Guide Is Organized
Conventions Used in This Guide
ANSI/ISO Compliance
Migrating an Application
Your Comments Are Welcome
Introduction
What Is an Oracle Precompiler?
Why Use the Oracle Pro*C/C++ Precompiler?
Why Use SQL?
Why Use PL/SQL?
What Does the Pro*C/C++ Precompiler Offer?
Does the Oracle Pro*C/C++ Precompiler Meet Industry Standards?
Migrating an Application from Earlier Releases
Frequently Asked Questions
Learning the Basics
Key Concepts of Embedded SQL Programming
Steps in Developing an Embedded SQL Application
Sample Tables
Sample Program: A Simple Query
Developing a Pro*C/C++ Application
The Pro*C/C++ Preprocessor
Migrating an Application
Programming Guidelines
Host Variables
Indicator Variables
Host Structures
Host Arrays
Pointer Variables
VARCHAR Variables
Handling Character Data
Oracle Datatypes
Datatype Conversion
Datatype Equivalencing
National Language Support
Multi-byte Character Sets
Cursor Variables
Connecting to Oracle
Concurrent Connections
Embedding Oracle Call Interface (OCI) Calls
Developing Multi-threaded Applications
Developing X/Open Applications
Using Embedded SQL
Using Host Variables
Using Indicator Variables
The Basic SQL Statements
Using the SELECT Statement
Using the INSERT Statement
Using Subqueries
Using the UPDATE Statement
Using the DELETE Statement
Using the WHERE Clause
Using Cursors
Using the DECLARE Statement
Using the OPEN Statement
Using the FETCH Statement
Using the CLOSE Statement
Optimizer Hints
Using the CURRENT OF Clause
Using All the Cursor Statements
A Complete Example
Using Embedded PL/SQL
Advantages of PL/SQL
Embedding PL/SQL Blocks
Using Host Variables
Using Indicator Variables
Using Host Arrays
Using Cursors
Stored Subprograms
Using Dynamic SQL
Using C++
Understanding C++ Support
Precompiling for C++
Sample Programs
Running the Pro*C/C++ Precompiler
Precompiler Command
Precompiler Options
What Occurs during Precompilation?
Scope of Options
Entering Options
Using the Precompiler Options
Obsolete Options
Conditional Precompilations
Guidelines for Precompiling Separately
Compiling and Linking
Defining and Controlling Transactions
Some Terms You Should Know
How Transactions Guard Your Database
How to Begin and End Transactions
Using the COMMIT Statement
Using the SAVEPOINT Statement
Using the ROLLBACK Statement
Using the RELEASE Option
Using the SET TRANSACTION Statement
Overriding Default Locking
Fetching Across COMMITs
Handling Distributed Transactions
Guidelines
Handling Runtime Errors
The Need for Error Handling
Error Handling Alternatives
The SQLSTATE Status Variable
Declaring SQLCODE
Key Components of Error Reporting Using the SQLCA
Using the SQL Communications Area (SQLCA)
Getting the Full Text of Error Messages
Using the WHENEVER Statement
Obtaining the Text of SQL Statements
Using the Oracle Communications Area (ORACA)
Using Host Arrays
What Is a Host Array?
Why Use Arrays?
Declaring Host Arrays
Using Arrays in SQL Statements
Selecting into Arrays
Inserting with Arrays
Updating with Arrays
Deleting with Arrays
Using Indicator Arrays
Using the FOR Clause
Using the WHERE Clause
Mimicking CURRENT OF
Using
sqlca.sqlerrd[2]
Using Dynamic SQL
What Is Dynamic SQL?
Advantages and Disadvantages of Dynamic SQL
When to Use Dynamic SQL
Requirements for Dynamic SQL Statements
How Dynamic SQL Statements Are Processed
Methods for Using Dynamic SQL
Using Method 1
Using Method 2
Using Method 3
Using Method 4
Using the DECLARE STATEMENT Statement
Using Host Arrays
Using PL/SQL
Implementing Dynamic SQL Method 4
Meeting the Special Requirements of Method 4
Understanding the SQLDA
Using the SQLDA Variables
Some Preliminaries
The Basic Steps
A Closer Look at Each Step
Sample Program: Dynamic SQL Method 4
Writing User Exits
What Is a User Exit?
Why Write a User Exit?
Developing a User Exit
Writing a User Exit
Calling a User Exit
Passing Parameters to a User Exit
Returning Values to a Form
An Example
Precompiling and Compiling a User Exit
Sample Program: A User Exit
Using the GENXTB Utility
Linking a User Exit into SQL*Forms
Guidelines
EXEC TOOLS Statements
New Features
Fetching NULLs without Using Indicator Variables
Support for Developing Multi-threaded Applications
Oracle Reserved Words, Keywords, and Namespaces
Oracle Reserved Words
Oracle Keywords
PL/SQL Reserved Words
Oracle Reserved Namespaces
Performance Tuning
What Causes Poor Performance?
How Can Performance Be Improved?
Using Host Arrays
Using Embedded PL/SQL
Optimizing SQL Statements
Using Indexes
Taking Advantage of Row-Level Locking
Eliminating Unnecessary Parsing
Syntactic and Semantic Checking
What Is Syntactic and Semantic Checking?
Controlling the Type and Extent of Checking
Specifying SQLCHECK=SEMANTICS
Specifying SQLCHECK=SYNTAX
Specifying SQLCHECK=NONE
Entering the SQLCHECK Option
System-Specific References
System-Specific Information
Embedded SQL Commands and Directives
Summary of Precompiler Directives and Embedded SQL Commands
About The Command Descriptions
How to Read Syntax Diagrams
ALLOCATE (Executable Embedded SQL Extension)
CLOSE (Executable Embedded SQL)
COMMIT (Executable Embedded SQL)
CONNECT (Executable Embedded SQL Extension)
CONTEXT ALLOCATE (Executable Embedded SQL Extension)
CONTEXT FREE (Executable Embedded SQL Extension)
CONTEXT USE (Oracle Embedded SQL Directive)
DECLARE CURSOR (Embedded SQL Directive)
DECLARE DATABASE (Oracle Embedded SQL Directive)
DECLARE STATEMENT (Embedded SQL Directive)
DECLARE TABLE (Oracle Embedded SQL Directive)
DELETE (Executable Embedded SQL)
DESCRIBE (Executable Embedded SQL)
ENABLE THREADS (Executable Embedded SQL Extension)
EXECUTE ... END-EXEC (Executable Embedded SQL Extension)
EXECUTE (Executable Embedded SQL)
EXECUTE IMMEDIATE (Executable Embedded SQL)
FETCH (Executable Embedded SQL)
INSERT (Executable Embedded SQL)
OPEN (Executable Embedded SQL)
PREPARE (Executable Embedded SQL)
ROLLBACK (Executable Embedded SQL)
SAVEPOINT (Executable Embedded SQL)
SELECT (Executable Embedded SQL)
TYPE (Oracle Embedded SQL Directive)
UPDATE (Executable Embedded SQL)
VAR (Oracle Embedded SQL Directive)
WHENEVER (Embedded SQL Directive)
Copyright © 1996 Oracle Corporation
500 Oracle Parkway, Redwood City, CA 94065
Library
Product