Oracle® Call Interface Programmer's Guide

Oracle? Call Interface

Programmer's Guide

21c

F31830-04 November 2023

Oracle Call Interface Programmer's Guide, 21c

F31830-04

Copyright ? 1996, 2023, Oracle and/or its affiliates.

Primary Author: Mamata Basapur

Contributing Authors: Rod Ward

Contributors: D. Adams, G. Arora, V. Arora, A. Bande, D. Banerjee, S. Banerjee, M. Bastawala, E. Belden, P. Betteridge, N. Bhatt, T. Bhosle, J. Blowney, R. Chakravarthula, S. Chandrasekar, B. Cheng, D. Chiba, L. Chidambaran, C. Colrain, T. Das, Ronald Decker, A. Desai, A. Downing, S. Fogel, T. Hoang, N. Ikeda, K. Itikarlapalli, C. Iyer, S. Iyer, V. Jitta, C. Jones, A. Keh, B. Khaladkar, S. Krishnaswamy, R. Kumar, R. Kumar, S. Lahorani, S. Lari, T. H. Lee, T. Li, C. Liang, I. Listvinsky, J. Liu, E. Lu, S. Lynn, K.Mensah, V. Moore, A. Mullick, K. Neel, M. Orgiyan, E. Paapanen, S. Pelski, R. Phillips, R. Pingte, R. Rajamani, M. Ramacher, A. Ramappa, S. Sahu, A. Saxena, S. Seshadri, R. Singh, B. Sinha, H. Slattery, J. Stewart, L. Sun, S. Suresh, S. Tata, H. Tran, A. Tuininga, S. Vallapureddy, M. Vemana, S. Vemuri, B. Venkatakrishnan, K. Verma, G. Viswanathan, S. Wolicki, L. Wong, S. Youssef, B. Zebian

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed, or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software," "commercial computer software documentation," or "limited rights data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed, or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle?, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.

Contents

Preface

Audience Documentation Accessibility Related Documents Conventions

1 OCI: Introduction

1.1 Overview of OCI 1.2 Building an OCI Application 1.3 Alternatives to OCI 1.4 SQL Statements

1.4.1 Data Definition Language 1.4.2 Control Statements 1.4.3 Data Manipulation Language 1.4.4 Queries 1.4.5 PL/SQL 1.4.6 Embedded SQL 1.4.7 Special OCI Terms for SQL 1.5 Procedural and Nonprocedural Elements 1.6 Object Support 1.6.1 Client-Side Object Cache 1.6.2 Associative and Navigational Interfaces 1.6.3 OCI Runtime Environment for Objects 1.6.4 Type Management: Mapping and Manipulation Functions 1.6.5 Object Type Translator 1.7 Simple Oracle Document Access (SODA) 1.8 Encapsulated Interfaces 1.9 User Authentication and Password Management 1.10 Features to Improve Application Performance and Scalability 1.11 Oracle Database Advanced Queuing 1.12 XA Library Support

lix lix lx lx

1-1 1-3 1-3 1-4 1-5 1-6 1-6 1-6 1-7 1-8 1-8 1-9 1-10 1-11 1-11 1-12 1-12 1-12 1-13 1-14 1-14 1-14 1-15 1-15

iii

1.13 Oracle Instant Client and Oracle Instant client Basic Light

2 Building and Configuring OCI Applications

2.1 Header File and Makefile Locations 2.2 Building an OCI Application on Linux and UNIX

2.2.1 Oracle Directory Structure 2.2.2 Demonstration OCI Programs 2.3 Building an Application on Windows 2.4 Database Connection Strings 2.4.1 Examples of Oracle Database Connection String Connect Identifiers 2.5 Client and Server Operating with Different Versions of Time Zone Files 2.6 OCI Client-Side Deployment Parameters Using oraaccess.xml 2.6.1 About oraaccess.xml 2.6.2 About Client-Side Deployment Parameters Specified in oraaccess.xml 2.6.3 High Level Structure of oraaccess.xml 2.6.4 About Specifying Global Parameters in oraaccess.xml 2.6.5 About Specifying Defaults for Connection Parameters 2.6.6 Overriding Connection Parameters at the Connection-String Level 2.6.7 About OCI Session Pool Configuration in oraaccess.xml 2.6.8 File (oraaccess.xml) Properties 2.7 About Compatibility and Upgrading 2.7.1 Oracle Client and Server Cross Version Compatibility 2.7.2 Version Compatibility of Statically Linked and Dynamically Linked Applications 2.7.3 Unsupported OCI Routines 2.8 Fault Diagnosability in OCI 2.8.1 About Fault Diagnosability in OCI 2.8.2 ADR Base Location 2.8.3 Using ADRCI 2.8.4 Controlling ADR Creation and Disabling Fault Diagnosability Using sqlnet.ora

3 OCI Programming Basics

3.1 Overview of OCI Program Programming 3.2 OCI Data Structures

3.2.1 Handles 3.2.1.1 About Allocating and Freeing Handles 3.2.1.2 Environment Handle 3.2.1.3 Error Handle 3.2.1.4 Service Context Handle and Associated Handles 3.2.1.5 Statement, Bind, and Define Handles

1-16

2-1 2-1 2-2 2-2 2-3 2-4 2-4 2-6 2-7 2-7 2-7 2-8 2-9 2-11 2-13 2-17 2-18 2-19 2-19 2-20 2-20 2-22 2-22 2-23 2-24 2-26

3-1 3-3 3-3 3-5 3-6 3-6 3-6 3-8

iv

3.2.1.6 Describe Handle 3.2.1.7 Complex Object Retrieval Handle 3.2.1.8 Thread Handle 3.2.1.9 Subscription Handle 3.2.1.10 Direct Path Handles 3.2.1.11 Connection Pool Handle 3.2.1.12 Handle Attributes 3.2.2 OCI Descriptors 3.2.2.1 Snapshot Descriptor 3.2.2.2 LOB and BFILE Locators 3.2.2.3 Parameter Descriptor 3.2.2.4 ROWID Descriptor 3.2.2.5 Date, Datetime, and Interval Descriptors 3.2.2.6 Complex Object Descriptor 3.2.2.7 Advanced Queuing Descriptors 3.2.2.8 User Memory Allocation 3.3 OCI Programming Steps 3.3.1 OCI Environment Initialization 3.3.1.1 About Creating the OCI Environment 3.3.1.2 About Allocating Handles and Descriptors 3.3.1.3 Application Initialization, Connection, and Session Creation 3.3.2 About Processing SQL Statements in OCI 3.3.3 Commit or Roll Back Operations 3.3.4 About Terminating the Application 3.3.5 Error Handling in OCI 3.3.5.1 Return and Error Codes for Data 3.3.5.2 Functions Returning Other Values 3.4 Additional Coding Guidelines 3.4.1 Operating System Considerations 3.4.2 Parameter Types 3.4.2.1 Address Parameters 3.4.2.2 Integer Parameters 3.4.2.3 Character String Parameters 3.4.3 Inserting Nulls into a Column 3.4.4 Indicator Variables 3.4.4.1 Input 3.4.4.2 Output 3.4.4.3 Indicator Variables for Named Data Types and REFs 3.4.5 About Canceling Calls 3.4.6 Positioned Updates and Deletes 3.4.7 Reserved Words

3-9 3-9 3-10 3-10 3-10 3-11 3-11 3-12 3-14 3-14 3-15 3-15 3-16 3-16 3-16 3-17 3-17 3-18 3-18 3-19 3-19 3-25 3-25 3-25 3-26 3-27 3-28 3-28 3-29 3-29 3-30 3-30 3-30 3-30 3-31 3-31 3-32 3-32 3-32 3-33 3-34

v

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download