Home
Home
Customize
Customize
Help
Help
Contact us
Contact Us

Table of Contents for Pro*C/C++ Precompiler Programmer's Guide

Contents

Title Page

Index

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

Your Comments Are Welcome.

Send Us Your Comments

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?

Frequently Asked Questions

Precompiler Concepts

Key Concepts of Embedded SQL Programming

Steps in Developing an Embedded SQL Application

Programming Guidelines

Conditional Precompilations

Precompiling Separately

Compiling and Linking

Sample Tables

Sample Program: A Simple Query

Database Concepts

Connecting to the Database

Advanced Connection Options

Definitions of Transactions Terms

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

Datatypes and Host Variables

Oracle Datatypes

Host Variables

Indicator Variables

VARCHAR Variables

Cursor Variables

CONTEXT Variables

Universal ROWIDs

Host Structures

Pointer Variables

National Language Support

NCHAR Variables

Advanced Topics

Handling Character Data

Datatype Conversion

Datatype Equivalencing

The C Preprocessor

Precompiled Header Files

The Oracle Preprocessor

Evaluation of Numeric Constants

SQLLIB Extensions for OCI Release 8 Interoperability

Interfacing to OCI Release 8

Embedding (OCI Release 7) Calls

New Names for SQLLIB Public Functions

Developing X/Open Applications

Embedded SQL

Using Host Variables

Using Indicator Variables

The Basic SQL Statements

The DML Returning Clause

Using Cursors

Optimizer Hints

Using the CURRENT OF Clause

Using All of the Cursor Statements

A Complete Example

Positioned Update

Embedded PL/SQL

Advantages of PL/SQL

Embedding PL/SQL Blocks

Using Host Variables

Using Indicator Variables

Using Host Arrays

Cursor Usage in Embedded PL/SQL

Stored PL/SQL and Java Subprograms

External Procedures

Using Dynamic SQL

Host Arrays

Why Use Arrays?

Declaring Host Arrays

Using Arrays in SQL Statements

Selecting into Arrays

Inserting with Arrays

Updating with Arrays

Deleting with Arrays

Using the FOR Clause

Using the WHERE Clause

Arrays of Structs

Mimicking CURRENT OF

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 Directive

Obtaining the Text of SQL Statements

Using the Oracle Communications Area (ORACA)

Precompiler Options

The Precompiler Command

Precompiler Options

Quick Reference

Entering Options

Using the Precompiler Options

Multithreaded Applications

What are Threads?

Runtime Contexts in Pro*C/C++

Runtime Context Usage Models

User Interface Features for Multithreaded Applications

Multithreaded Example

C++ Applications

Understanding C++ Support

Precompiling for C++

Sample Programs

Oracle 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 PL/SQL

ANSI Dynamic SQL

Basics of ANSI Dynamic SQL

Overview of ANSI SQL Statements

Oracle Extensions

ANSI Dynamic SQL Precompiler Options

Full Syntax of the Dynamic SQL Statements

Sample Programs

Oracle 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

Large Objects (LOBs)

What are LOBs?

How to Use LOBs in Your Program

Rules for LOB Statements

LOB Statements

LOBs and the Navigational Interface

LOB Program Examples

Objects

Introduction to Objects

Using Object Types in Pro*C/C++

The Object Cache

Associative Interface

Navigational Interface

Converting Object Attributes and C Types

Object Options Set/Get

New Precompiler Options for Objects

An Object Example in Pro*C/C++

Sample Code for Navigational Access

Using C Structures

Using REFs

Using OCIDate, OCIString, OCINumber, and OCIRaw

Summarizing the New Database Types in Pro*C/C++

Restrictions on Using Oracle8i Datatypes in Dynamic SQL

Collections

Collections

Descriptors for Collections

OBJECT GET and SET

Collection Statements

Collection Sample Code

The Object Type Translator

OTT Overview

What Is the Object Type Translator

Using OTT with OCI Applications

Using OTT with Pro*C/C++ Applications

OTT Reference

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

Array of Structs

Precompiled Header Files

CALL Statement

Changing Passwords at Runtime

Support for National Character Sets

CHAR_MAP Precompiler Option

New Names for SQLLIB Functions

New Actions in WHENEVER Statement

Object Type Support

Object Type Translator

LOB Support

ANSI Dynamic SQL

Collections

Miscellaneous Topics

Migration From Earlier Releases

Reserved Words, Keywords, and Namespaces

Reserved Words and Keywords

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

Entering the SQLCHECK Option

System-Specific References

System-Specific Information

Embedded SQL Statements and Directives

Summary of Precompiler Directives and Embedded SQL Statements

About The Statement Descriptions

How to Read Syntax Diagrams

ALLOCATE (Executable Embedded SQL Extension)

ALLOCATE DESCRIPTOR (Executable Embedded SQL)

CACHE FREE ALL (Executable Embedded SQL Extension)

CALL (Executable Embedded SQL)

CLOSE (Executable Embedded SQL)

COLLECTION APPEND (Executable Embedded SQL Extension)

COLLECTION DESCRIBE (Executable Embedded SQL Extension)

COLLECTION GET (Executable Embedded SQL Extension)

COLLECTION RESET (Executable Embedded SQL Extension)

COLLECTION SET (Executable Embedded SQL Extension)

COLLECTION TRIM (Executable Embedded SQL Extension)

COMMIT (Executable Embedded SQL)

CONNECT (Executable Embedded SQL Extension)

CONTEXT ALLOCATE (Executable Embedded SQL Extension)

CONTEXT FREE (Executable Embedded SQL Extension)

CONTEXT OBJECT OPTION GET (Executable Embedded SQL Extension)

CONTEXT OBJECT OPTION SET (Executable Embedded SQL Ext)

CONTEXT USE (Oracle Embedded SQL Directive)

DEALLOCATE DESCRIPTOR (Embedded SQL Statement)

DECLARE CURSOR (Embedded SQL Directive)

DECLARE DATABASE (Oracle Embedded SQL Directive)

DECLARE STATEMENT (Embedded SQL Directive)

DECLARE TABLE (Oracle Embedded SQL Directive)

DECLARE TYPE (Oracle Embedded SQL Directive)

DELETE (Executable Embedded SQL)

DESCRIBE (Executable Embedded SQL Extension)

DESCRIBE DESCRIPTOR (Executable Embedded SQL)

ENABLE THREADS (Executable Embedded SQL Extension)

EXECUTE ... END-EXEC (Executable Embedded SQL Extension)

EXECUTE (Executable Embedded SQL)

EXECUTE DESCRIPTOR (Executable Embedded SQL)

EXECUTE IMMEDIATE (Executable Embedded SQL)

FETCH (Executable Embedded SQL)

FETCH DESCRIPTOR (Executable Embedded SQL)

FREE (Executable Embedded SQL Extension)

GET DESCRIPTOR (Executable Embedded SQL)

INSERT (Executable Embedded SQL)

LOB APPEND (Executable Embedded SQL Extension)

LOB ASSIGN (Executable Embedded SQL Extension)

LOB CLOSE (Executable Embedded SQL Extension)

LOB COPY (Executable Embedded SQL Extension)

LOB CREATE TEMPORARY (Executable Embedded SQL Extension)

LOB DESCRIBE (Executable Embedded SQL Extension)

LOB DISABLE BUFFERING (Executable Embedded SQL Extension)

LOB ENABLE BUFFERING (Executable Embedded SQL Extension)

LOB ERASE (Executable Embedded SQL Extension)

LOB FILE CLOSE ALL (Executable Embedded SQL Extension)

LOB FILE SET (Executable Embedded SQL Extension)

LOB FLUSH BUFFER (Executable Embedded SQL Extension)

LOB FREE TEMPORARY (Executable Embedded SQL Extension)

LOB LOAD (Executable Embedded SQL Extension)

LOB OPEN (Executable Embedded SQL Extension)

LOB READ (Executable Embedded SQL Extension)

LOB TRIM (Executable Embedded SQL Extension)

LOB WRITE (Executable Embedded SQL Extension)

OBJECT CREATE (Executable Embedded SQL Extension)

OBJECT DELETE (Executable Embedded SQL Extension)

OBJECT DEREF (Executable Embedded SQL Extension)

OBJECT FLUSH (Executable Embedded SQL Extension)

OBJECT GET (Executable Embedded SQL Extension)

OBJECT RELEASE (Executable Embedded SQL Extension)

OBJECT SET (Executable Embedded SQL Extension)

OBJECT UPDATE (Executable Embedded SQL Extension)

OPEN (Executable Embedded SQL)

OPEN DESCRIPTOR (Executable Embedded SQL)

PREPARE (Executable Embedded SQL)

REGISTER CONNECT (Executable Embedded SQL Extension)

ROLLBACK (Executable Embedded SQL)

SAVEPOINT (Executable Embedded SQL)

SELECT (Executable Embedded SQL)

SET DESCRIPTOR (Executable Embedded SQL)

TYPE (Oracle Embedded SQL Directive)

UPDATE (Executable Embedded SQL)

VAR (Oracle Embedded SQL Directive)

WHENEVER (Embedded SQL Directive)