Oracle Call Interface Programmer's Guide
Release 8.1.5






Prev Next


The Oracle Call Interface (OCI) is an application programming interface (API) that allows applications written in C to interact with one or more Oracle servers. The OCI gives your programs the capability to perform the full range of database operations that are possible with an Oracle database server, including SQL statement processing and object manipulation.

The Preface includes the following sections:

Purpose of this Guide

This guide provides a sound basis for developing applications using the OCI. The guide is divided into two volumes.

Volume I contains information about the following topics:

Volume II contains the following information:


The Oracle Call Interface Programmer's Guide is intended for programmers developing new applications or converting existing applications to run in the Oracle environment. This comprehensive treatment of the OCI will also be valuable to systems analysts, project managers, and others interested in the development of database applications.

This guide assumes that you have a working knowledge of application programming using C. Readers should also be familiar with the use of Structured Query Language (SQL) to access information in relational database systems. In addition, some sections of this guide also assume a knowledge of the basic concepts of object-oriented programming.

For information about SQL, refer to the Oracle8i SQL Reference and the Oracle8i Administrator's Guide. For information about basic Oracle concepts, see Oracle8i Concepts.

Feature Coverage and Availability

The Oracle Call Interface Programmer's Guide contains information that describes the features and functionality of the Oracle8i and Oracle8i Enterprise Edition products. Oracle8i and Oracle8i Enterprise Edition have the same basic features. However, several advanced features are included only with the Enterprise Edition, such as the Objects Option.

For information about the differences between Oracle8i and Oracle8i Enterprise Edition and the features and options that are available to you, see Getting to Know Oracle8i.

For information about cartridge services, and using OCI calls to develop cartridges, refer to Oracle8i Data Cartridge Developer's Guide.

How to Use this Guide

The Oracle Call Interface Programmer's Guide provides an introduction to the features of the OCI for both new OCI programmers and those programmers who have previously worked with earlier versions of the OCI.


Part 1

Part 1 of this guide (Chapter 1 through Chapter 9) provides conceptual information about how to program with the OCI to build scalable application solutions that provide access to relational data in an Oracle database. This part also describes the basics of OCI programming and the foundation for the discussion of object-relational features in Part 2.

Part 2

Part 2 of this guide (Chapter 10 through Chapter 14) describes OCI functionality for accessing object-relational data with the OCI. The chapters in this part describe how to retrieve and manipulate objects through an Oracle server.


Part 3

Part 3 of this book (Chapter 15 through Chapter 18) lists OCI function calls in the Oracle OCI library.

Part 4

Part 4 of this book (Appendix A through Appendix C) provides additional reference information about OCI programming.

Where to Begin

Because of the many enhancements to OCI, both new and experienced users should read the conceptual material in Part 1.

Readers familiar with the current version of the OCI and interested in its object capabilities may want to skim Part 1 and then begin reading the chapters in Part 2.

Readers looking for reference information, such as OCI function syntax and handle attribute descriptions, should refer to Part 3 and Part 4 of Volume II.

How this Guide Is Organized

The Oracle Call Interface Programmer's Guide contains four parts, split between two volumes. A brief summary of what you will find in each chapter and appendix follows:


Chapter 1, "Introduction, New Features, and Upgrading"

This chapter introduces you to the Oracle Call Interface and describes special terms and typographical conventions that are used in describing the interface. This chapter also discusses features new to the current release.

Chapter 2, "OCI Programming Basics"

This chapter gives you the basic concepts needed to develop an OCI program. It discusses the essential steps each OCI program must include, and how to retrieve and understand error messages

Chapter 3, "Datatypes"

Understanding how data is converted between Oracle tables and variables in your host program is essential for using the OCI interfaces. This chapter discusses Oracle internal and external datatypes, and data conversions.

Chapter 4, "SQL Statement Processing"

This chapter discusses the steps involved in SQL statements using the Oracle OCI.

Chapter 5, "Binding and Defining"

This chapter discusses OCI bind and define operations in detail, including a discussion of advanced bind and define operations.

Chapter 6, "Describing Schema Metadata"

This chapter discusses how to use the OCIDescribeAny() call to obtain information about schema objects and their associated elements.

Chapter 7, "LOB and FILE Operations"

This chapter describes the OCI support for LOB, FILE, and temporary LOB datatypes.

Chapter 8, "Managing Scalable Platforms"

This chapter describes password management, session management, and thread safety.

Chapter 9, "OCI Programming Advanced Topics"

This chapter covers more sophisticated OCI programming topics, including descriptions of user callbacks, publish-subscribe notification, direct path loading, and other functionality.

Chapter 10, "OCI Object-Relational Programming"

This chapter provides an introduction to the concepts involved when using the OCI to access objects in an Oracle database server. The chapter includes a discussion of basic object concepts and object pinning, and the basic structure of object-relational applications.

Chapter 11, "Object-Relational Datatypes"

This chapter outlines the object datatypes used in OCI programming.

Chapter 12, "Binding and Defining in Object Applications"

This chapter discusses the C mappings of user-defined datatypes in an Oracle database, and the functions that manipulate such data. Binding and defining using these C mappings is also covered.

Chapter 13, "Object Cache and Object Navigation"

This chapter provides an introduction to the concepts involved when using the OCI to access objects in an Oracle database server. This chapter also discusses the Object Cache, and the use of the OCI navigational calls to manipulate objects retrieved from the server.

Chapter 14, "Using the Object Type Translator"

This chapter discusses the use of the Object Type Translator to convert database object definitions to C structure representations for use in OCI applications.


Chapter 15, "OCI Relational Functions"

This chapter contains a list of the OCI relational functions, including syntax, comments, parameter descriptions, and other useful information.

Chapter 16, "OCI Navigational and Type Functions"

This chapter contains a list of the OCI navigational functions, including syntax, comments, parameter descriptions, and other useful information.

Chapter 17, "OCI Datatype Mapping and Manipulation Functions"

This chapter contains a list of the OCI datatype mapping and manipulation functions, including syntax, comments, parameter descriptions, and other useful information.

Chapter 18, "OCI External Procedure Functions"

This chapter discusses special OCI functions used by external procedures.

See Also: For a a discussion of the OCI functions that apply to an NLS environment, see the Oracle8i National Language Support Guide. For a discussion of the OCI functions that apply to cartridge services, see the Oracle8i Data Cartridge Developer's Guide.

Appendix A, "Handle and Descriptor Attributes"

This appendix describes the attributes of OCI application handles that can be set or read using OCI calls.

Appendix B, "OCI Demonstration Programs"

This appendix includes a listing of important OCI demonstration programs that are included with the Oracle installation.

Appendix C, "OCI Function Server Roundtrips"

This appendix includes tables which show the number of server roundtrips required by various OCI applications.

Conventions Used in this Guide

The following notational and text formatting conventions are used in this guide:

[ ]

Square brackets indicate that the enclosed item is optional. Do not type the brackets.

{ }

Braces enclose items of which only one is required.


A vertical bar separates items within braces, and may also be used to indicate that multiple values are passed to a function parameter.


In code fragments, an ellipsis means that code not relevant to the discussion has been omitted.

font change

SQL or C code examples are shown in monospaced font.


Italics are used for OCI parameters, OCI routines names, file names, and data fields.


Uppercase is used for SQL or PL/SQL keywords, like SELECT or UPDATE. To view the lists of the Oracle keywords or reserved words for SQL and PL/SQL, see the Oracle8i SQL Reference and the PL/SQL User's Guide and Reference.


Boldface type is used to identify the names of C datatypes, like ub4, sword, or OCINumber.

This guide uses special text formatting to draw the reader's attention to some information. A paragraph that is indented and begins with a bold text label may have special meaning. The following paragraphs describe the different types of information that are flagged this way.

Note: The Note flag indicates that the reader should pay particular attention to the information to avoid a common problem or increase understanding of a concept.

7.x Upgrade Note: An item marked with "7.x Upgrade Note" typically alerts the programmer to something that is done much differently in the release 8 OCI than in the 7.x OCIs.

Warning: An item marked as Warning indicates something that an OCI programmer must be careful to do or not do in order for an application to work correctly.

See Also: Text marked See Also points you to another section of this guide, or to other documentation, for additional information about the topic being discussed.

Your Comments Are Welcome

We value and appreciate your comments as an Oracle user and reader of our manuals. As we write, revise, and evaluate our documentation, your opinions are the most important feedback we receive.

You can send comments and suggestions about this manual to the Information Development department at the following e-mail address:

If you prefer, you can send letters or faxes containing your comments to the following address:

Oracle Server Documentation Manager

Oracle Corporation

500 Oracle Parkway

Redwood Shores, CA 94065

Fax: (650) 506-7228


Copyright © 1999 Oracle Corporation.

All Rights Reserved.