Oracle Call Interface Programmer's Guide, Release

Total Page:16

File Type:pdf, Size:1020Kb

Oracle Call Interface Programmer's Guide, Release Oracle Call Interface Programmer’s Guide, Volumes 1 & 2 Release 8.0 December 1997 Part No. A58234-01 Oracle Call Interface Programmer’s Guide Part No. A58234-01 Release 8.0 Copyright © 1997, Oracle Corporation. All rights reserved. Primary Author: Phil Locke Contributors: John Bellemore, John Boonleungtomnu, Sashi Chandrasekaran, Debashish Chatterjee, Ernest Chen, Calvin Cheng, Luxi Chidambaran, Diana Foch-Lorentz, Sreenivas Gollapudi, Brajesh Goyal, Radhakrishna Hari, Don Herkimer, Amit Jasuja, Sanjay Kaluskar, Kai Korot, Susan Kotsovolos, Srinath Krishnaswamy, Ramkumar Krishnan, Sanjeev Kumar, Thomas Kurian, Paul Lane, Shoaib Lari, Chon Lei, Nancy Liu, Valarie Moore, Tin Nguyen, Denise Oertel, Rosanne Park, Jacqui Pons, Den Raphaely, Anindo Roy, Tim Smith, Ekrem Soylemez, Ashwini Surpur, Sudheer Thakur, Alan Thiessen, Peter Vasterd, Randall Whitman, Joyo Wijaya, Allen Zhao This book is dedicated to the memory of Denise Elizabeth Oertel. The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright patent and other intellectual property law. Reverse engineering of the Programs is prohibited. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be licensee's responsibility to take all appropriate fail-safe, back up, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle disclaims liability for any damages caused by such use of the Programs. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error free. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If this Program is delivered to a U.S. Government Agency of the Department of Defense, then it is delivered with Restricted Rights and the following legend is applicable: Restricted Rights Legend Programs delivered subject to the DOD FAR Supplement are 'commercial computer software' and use, duplication and disclosure of the Programs shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are 'restricted computer software' and use, duplication and disclosure of the Programs shall be subject to the restrictions in FAR 52..227-14, Rights in Data -- General, including Alternate III (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. Oracle, SQL*Forms, SQL*Net, and SQL*Plus are registered trademarks of Oracle Corporation, Redwood Shores, California. Oracle Call Interface, Oracle7, Oracle7 Server, Oracle8, Oracle Forms, PL/SQL, Pro*C, Pro*C/C++, Pro*COBOL, Net8, and Trusted Oracle are trademarks of Oracle Corporation, Redwood Shores, California. All other products or company names are used for identification purposes only, and may be trademarks of their respective owners. Contents Send Us Your Comments .............................................................................................................. xxvii Preface........................................................................................................................................................ xxix Purpose of this Guide ........................................................................................................................ xxx Audience............................................................................................................................................... xxx Feature Coverage and Availability ................................................................................................. xxxi How to Use this Guide...................................................................................................................... xxxi How this Guide Is Organized ........................................................................................................ xxxii Conventions Used in this Guide ................................................................................................... xxxv Your Comments Are Welcome....................................................................................................... xxxvi Part I Basic OCI Concepts 1 Introduction and New Features The Oracle Call Interface .................................................................................................................. 1-2 SQL Statements................................................................................................................................... 1-4 Data Definition Language ........................................................................................................... 1-4 Control Statements ....................................................................................................................... 1-5 iii Data Manipulation Language ..................................................................................................... 1-5 Queries ........................................................................................................................................... 1-5 PL/SQL .......................................................................................................................................... 1-6 Embedded SQL ............................................................................................................................. 1-7 Special OCI/SQL Terms..................................................................................................................... 1-8 Object Support in the OCI ................................................................................................................ 1-8 Parts of the OCI ................................................................................................................................. 1-10 Release 8.0 New Features................................................................................................................. 1-10 Obsolescent and Obsolete OCI Calls............................................................................................ 1-11 Compiling and Linking ................................................................................................................... 1-11 2 OCI Programming Basics Overview............................................................................................................................................... 2-2 OCI Program Structure ...................................................................................................................... 2-3 OCI Data Structures ........................................................................................................................... 2-5 Handles ................................................................................................................................................. 2-6 Allocating and Freeing Handles................................................................................................. 2-7 Environment Handle.................................................................................................................... 2-8 Error Handle.................................................................................................................................. 2-8 Service Context and Associated Handles.................................................................................. 2-8 Statement Handle, Bind Handle, and Define Handle ........................................................... 2-10 Describe Handle.......................................................................................................................... 2-10 Complex Object Retrieval Handle............................................................................................ 2-10 Security Handle........................................................................................................................... 2-10 Handle Attributes ....................................................................................................................... 2-11 User Memory Allocation ........................................................................................................... 2-12 Descriptors and Locators ................................................................................................................. 2-12 Snapshot Descriptor ................................................................................................................... 2-13 LOB/FILE Datatype Locator..................................................................................................... 2-13 Parameter Descriptor ................................................................................................................. 2-14 ROWID Descriptor ..................................................................................................................... 2-15 Complex Object Descriptor ....................................................................................................... 2-15 Advanced Queueing Descriptors ............................................................................................
Recommended publications
  • Database Application Development Overview SQL in Application Code SQL in Application Code (Contd.) Embedded SQL Embedded SQL: Va
    Overview Concepts covered in this lecture: Database Application Development SQL in application code Embedded SQL Cursors Chapter 6 Dynamic SQL JDBC SQLJ Stored procedures Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2 SQL in Application Code SQL in Application Code (Contd.) SQL commands can be called from within a host language (e.g., C++ or Java) program. Impedance mismatch: SQL statements can refer to host variables SQL relations are (multi-) sets of records, with (including special variables used to return status). no a priori bound on the number of records. Must include a statement to connect to the right No such data structure exist traditionally in database. procedural programming languages such as Two main integration approaches: C++. (Though now: STL) Embed SQL in the host language (Embedded SQL, SQL supports a mechanism called a cursor to SQLJ) handle this. Create special API to call SQL commands (JDBC) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 4 Embedded SQL Embedded SQL: Variables Approach: Embed SQL in the host language. A preprocessor converts the SQL statements into special API calls. EXEC SQL BEGIN DECLARE SECTION Then a regular compiler is used to compile the char c_sname[20]; code. long c_sid; short c_rating; float c_age; Language constructs: EXEC SQL END DECLARE SECTION Connecting to a database: EXEC SQL CONNECT Declaring variables: Two special “error” variables: EXEC SQL BEGIN (END) DECLARE SECTION SQLCODE (long, is negative if an error has occurred) Statements: SQLSTATE (char[6], predefined codes for common errors) EXEC SQL Statement; Database Management Systems 3ed, R.
    [Show full text]
  • Openvms Guide
    Mimer SQL OpenVMS Guide Version 11.0 Mimer SQL, OpenVMS Guide, Version 11.0, January 2018 © Copyright Mimer Information Technology AB. The contents of this manual may be printed in limited quantities for use at a Mimer SQL installation site. No parts of the manual may be reproduced for sale to a third party. Information in this document is subject to change without notice. All registered names, product names and trademarks of other companies mentioned in this documentation are used for identification purposes only and are acknowledged as the property of the respective company. Companies, names and data used in examples herein are fictitious unless otherwise noted. Produced and published by Mimer Information Technology AB, Uppsala, Sweden. Mimer SQL Web Sites: https://developer.mimer.com https://www.mimer.com Contents i Contents .............................................................................................................................. i Chapter 1 Introduction .......................................................................................1 About Mimer SQL for OpenVMS...................................................................................1 The Mimer SQL Database Server .................................................................................. 1 Embedded SQL................................................................................................................. 1 Module SQL......................................................................................................................
    [Show full text]
  • Embedded SQL N Functions and Procedural Constructs N Triggers
    CS425 – Summer 2016 Jason Arnold Chapter 6: Advanced SQL modified from: Database System Concepts, 6th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Chapter 6: Advanced SQL n Accessing SQL From a Programming Language l Dynamic SQL JDBC and ODBC l Embedded SQL n Functions and Procedural Constructs n Triggers Textbook: Chapter 5 CS425 – Fall 2013 – Boris Glavic 5.2 ©Silberschatz, Korth and Sudarshan Accessing SQL From a Programming Language CS425 – Fall 2013 – Boris Glavic 5.3 ©Silberschatz, Korth and Sudarshan JDBC and ODBC n API (application-program interface) for a program to interact with a database server n Application makes calls to l Connect with the database server l Send SQL commands to the database server l Fetch tuples of result one-by-one into program variables n ODBC (Open Database Connectivity) works with C, C++, C#, and Visual Basic l Other API’s such as ADO.NET sit on top of ODBC n JDBC (Java Database Connectivity) works with Java CS425 – Fall 2013 – Boris Glavic 5.4 ©Silberschatz, Korth and Sudarshan Native APIs n Most DBMS also define DBMS specific APIs n Oracle: OCI n Postgres: libpg … CS425 – Fall 2013 – Boris Glavic 5.5 ©Silberschatz, Korth and Sudarshan JDBC n JDBC is a Java API for communicating with database systems supporting SQL. n JDBC supports a variety of features for querying and updating data, and for retrieving query results. n JDBC also supports metadata retrieval, such as querying about relations present in the database and the names and types of relation attributes.
    [Show full text]
  • Oracle Database Oracle C++ Call Interface Programmer's Guide
    Oracle® C++ Call Interface Programmer's Guide, 11g Release 2 (11.2) E10764-04 February 2013 Oracle C++ Call Interface Programmer's Guide, 11g Release 2 (11.2) E10764-04 Copyright © 1999, 2013, Oracle and/or its affiliates. All rights reserved. Primary Authors: Rod Ward, Roza Leyderman Contributors: Sandeepan Banerjee, Subhranshu Banergee, Kalyanji Chintakayala, Krishna Itikarlapalli, Shankar Iyer, Maura Joglekar, Toliver Jue, Ravi Kasamsetty, Srinath Krishnaswamy, Shoaib Lari, Geoff Lee, Chetan Maiya, Rekha Vallam 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 or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs.
    [Show full text]
  • Developing Embedded SQL Applications
    IBM DB2 10.1 for Linux, UNIX, and Windows Developing Embedded SQL Applications SC27-3874-00 IBM DB2 10.1 for Linux, UNIX, and Windows Developing Embedded SQL Applications SC27-3874-00 Note Before using this information and the product it supports, read the general information under Appendix B, “Notices,” on page 209. Edition Notice This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. You can order IBM publications online or through your local IBM representative. v To order publications online, go to the IBM Publications Center at http://www.ibm.com/shop/publications/ order v To find your local IBM representative, go to the IBM Directory of Worldwide Contacts at http://www.ibm.com/ planetwide/ To order DB2 publications from DB2 Marketing and Sales in the United States or Canada, call 1-800-IBM-4YOU (426-4968). When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright IBM Corporation 1993, 2012. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Chapter 1. Introduction to embedded Include files for COBOL embedded SQL SQL................1 applications .............29 Embedding SQL statements
    [Show full text]
  • SQL in Application Programs JDBC: Java Database Connectivity
    SQL in Application Programs JDBC: Java Database Connectivity CLI: Call-Level Interface Embedded SQL We have seen how SQL is used at the generic query interface --- an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional programs interacting with SQL. Want to consider: How do we enable a database to interact with an “ordinary” program written in a language such as C or Java? How do we deal with the differences in data types supported by SQL and conventional languages? In particular, relations, which are the result of queries, are not directly supported by conventional languages. A common environment for using a database has three tiers of processors: 1. Web servers --- Connect users to the database, usually over the Internet, or possibly a local connection. 2. Application servers --- Execute the “business logic” – whatever it is the system is supposed to do. 3. Database servers --- Run the DBMS and execute queries and modifications at the request of the application servers. Database holds the information about products, customers, etc. Business logic includes things like “what do I do after someone clicks ‘checkout’?” Answer: Show the “How will you pay for this?” screen. For this section, we will deal with the interaction between the application and the DBMS A SQP environment is the framework under which data exists and SQL operations are executed. Think of a SQL environment as a DBMS running at some installation. So tables, triggers, views, etc are defined within a SQL environment Database servers maintain some number of connections, so app servers can ask queries or perform modifications.
    [Show full text]
  • Embedded SQL Guide for RM/Cobol
    Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...............................................................................................................................6 1.1. General...........................................................................................................................................6 1.2. Reading this Guide.........................................................................................................................6 1.3. Definition of Terms........................................................................................................................6 1.4. Declaring Host Variables...............................................................................................................7 1.5. Declaring and Accessing Databases...............................................................................................7 1.6. Transactions....................................................................................................................................7 1.7. SQL Statements..............................................................................................................................8 1.8. Statement Handles..........................................................................................................................8 1.9. Dynamic SQL (DSQL)...................................................................................................................8 1.10. Error
    [Show full text]
  • Free Pascal Sql Select with Like Clause
    Free Pascal Sql Select With Like Clause Spiritualistic Claude usually overtoils some urolith or crews devotionally. Bartholemy obliterate sinisterly while unrestored Charley fubbed languorously or expertizes flatteringly. Unreproaching and thermogenetic Ignatius still denounced his hoaxer ravingly. Many machines as such features including zmbufdataset unit, to assign the line options manipulation capabilities of the address to perform different component with pascal, binary collating sequence is very reason Test runner that allows DUnit Tests to output NUnit compatible XML. Connection to the DB could smuggle the grade is those Tables and Fields actually there, supporting joint development efforts, profile parameters of the SAP system etc. Bug cannot remove hook up to ensure that the firebird allows you use the database location of leonardos upcoming posts and free pascal sql select with like clause too big table to follow this may know about! If you include a Column now, so the comma comes after the eight column name, fit better still use one house the Free Pascal mirror sites. You can freeze anything that want shut it. In the TextBox control type echo following SQL statement. ZONE which also stores the time zone. The same order by the column definitions, like sql with free pascal select clause. The databases reverential integrity will make tough very difficult. Delphi ide plugin for this blog and database file, which extend this with free pascal sql select with like clause to be. How to define future new exception type. The leave that visitors are registered is such order anymore the SQL is called and hunger find not the most reliable is compulsory register them in each order of launch, window, at least.
    [Show full text]
  • Database Programming Week 9
    Database Programming Week 9 *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford SQL in Real Programs • We have seen only how SQL is used at the generic query interface --- an environment where we sit at a terminal and ask queries of a database. • Reality is almost always different. – Programs in a conventional language like C are written to access a database by “calls” to SQL statements. 2 Database Programming Code in Programming Language SQL Sequence of tuples Database 3 SQL in Application Code • SQL commands can be called from within a host language (e.g., C++ or Java) program. – SQL statements can refer to host variables (including special variables used to return status). – Must include a statement to connect to the right database. • Two main integration approaches: – Embed SQL in the host language (embedded SQL, SQLJ) – Create special API to call SQL commands (JDBC) 4 SQL in Application Code (Con’t) • Impedance mismatch – SQL relations are (multi-) sets of records, with no a priori bound on the number of records. Typically, no such data structure in programming languages such as C/ C++ (Though now: STL). – SQL supports a mechanism called a cursor to handle this. 5 Embedded SQL • Approach: Embed SQL in the host language. – A preprocessor converts/translates the SQL statements into special API calls. – Then a regular compiler is used to compile the code. 6 Embedded SQL • Language constructs: – Connecting to a database !EXEC SQL CONNECT :usr_pwd;! !// the host variable usr_pwd contains your
    [Show full text]
  • Openvms Guide
    Mimer SQL OpenVMS Guide Version 10.1 Mimer SQL, OpenVMS Guide, Version 10.1, December 2017 © Copyright Mimer Information Technology AB. The contents of this manual may be printed in limited quantities for use at a Mimer SQL installation site. No parts of the manual may be reproduced for sale to a third party. Information in this document is subject to change without notice. All registered names, product names and trademarks of other companies mentioned in this documentation are used for identification purposes only and are acknowledged as the property of the respective company. Companies, names and data used in examples herein are fictitious unless otherwise noted. Produced and published by Mimer Information Technology AB, Uppsala, Sweden. P.O. Box 1713, SE-751 47 Uppsala, Sweden. Tel +46(0)18-780 92 00. Fax +46(0)18-780 92 40. Mimer SQL Web Sites: http://developer.mimer.com http://www.mimer.com Contents i Contents .............................................................................................................................. i Chapter 1 Introduction ....................................................................................... 1 About Mimer SQL for OpenVMS...................................................................................1 The Mimer SQL Database Server .................................................................................. 1 Embedded SQL................................................................................................................. 1 JDBC Driver......................................................................................................................
    [Show full text]
  • Oracle Rdb™ SQL Reference Manual Volume 2
    Oracle Rdb™ SQL Reference Manual Volume 2 Release 7.2 for HP OpenVMS Industry Standard 64 for Integrity Servers and OpenVMS Alpha operating systems October 2006 ® DEC_Callout (encoded characters) FullName: DEC Modular Callouts Distiller, PostScript v3011.104 r0 Notice: Copyright 1988 - 1993, Digital Equipment Corporation. Font version: 1.3, 13-Oct-1993 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 40 1.000 41 1.000 42 1.000 43 1.000 44 1.000 45 1.000 46 1.000 47 1.000 50 1.000 51 1.000 52 0.500 53 0.500 54 0.500 55 0.500 56 0.500 57 0.500 cx0 cx1 cx2 cx3 cx4 cx5 cx6 cx7 cx8 cx9 bx0 bx1 bx2 bx3 bx4 bx5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 60 0.500 61 0.500 62 0.500 63 0.500 64 0.375 65 0.375 66 0.375 67 0.375 70 0.375 71 0.375 72 0.375 73 0.375 74 0.375 75 0.375 76 0.500 77 0.500 bx6 bx7 bx8 bx9 mx0 mx1 mx2 mx3 mx4 mx5 mx6 mx7 mx8 mx9 ex0 ex1 2 3 4 5 6 7 8 9 100 0.500 101 0.500 102 0.500 103 0.500 104 0.500 105 0.500 106 0.500 107 0.500 110 0.000 111 0.000 112 0.000 113 0.000 114 0.000 115 0.000 116 0.000 117 0.000 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 120 0.000 121 0.000 122 0.000 123 0.000 124 0.000 125 0.000 126 0.000 127 0.000 130 0.000 131 0.000 132 0.000 133 0.000 134 0.000 135 0.000 136 0.000 137 0.000 140 0.000 141 0.000 142 0.000 143 0.000 144 0.000 145 0.000 146 0.000 147 0.000 150 0.000 151 0.000 152 0.000 153 0.000 154 0.000 155 0.000 156 0.000 157 0.000 160 0.000 161 0.000 162 0.000 163 0.000 164 0.000 165 0.000 166 0.000 167 0.000 170 0.000 171 0.000 172 0.000 173 0.000 174 0.000 175 0.000 176 0.000 177 0.000 0123456789012345678901234567890123456789
    [Show full text]
  • Object-Relational Features 10G Release 2 (10.2) B14260-01
    Oracle® Database Application Developer’s Guide - Object-Relational Features 10g Release 2 (10.2) B14260-01 June 2005 Oracle Database Application Developer's Guide - Object-Relational Features 10g Release 2 (10.2) B14260-01 Copyright © 1996, 2005, Oracle. All rights reserved. Contributors: Geeta Arora, Eric Belden, Chandrasekharan Iyer, Geoff Lee, Anand Manikutty, Valarie Moore, Magdi Morsi, Helen Yeh, Adiel Yoaz, Qin Yu The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations.
    [Show full text]