Obsolescent OCI Routines
This chapter introduces you to the Oracle Call Interface, Release 7.3. It gives you the background information that you need to develop applications using the interface. It also introduces special terms that are used in discussing the interface. The following topics are covered:
The Oracle Call Interface
Structured Query Language (SQL) is a non-procedural language. A program in a non-procedural language specifies the set of data to be operated on, but does not specify precisely how the operations are to be carried out. The non-procedural nature of SQL makes it an easy language to learn and to use to perform simple database transactions.
However, third-generation programming languages such as C/C++, COBOL, and FORTRAN are procedural. The execution of most statements depends on preceding or following statements and on control structures, such as loops or conditional branches. The procedural nature of these languages makes them more complex than SQL, but it also makes them very flexible and powerful.
The OCI allows you to develop applications that take advantage of the non-procedural capabilities of SQL and the procedural capabilities of a third-generation language. You can also take advantage of PL/SQL, Oracle7's procedural extensions to SQL, in your OCI application. Thus, the applications you develop can be more powerful and flexible than applications written in SQL alone.
What is the OCI?
The OCI is a set of Application Programming Interfaces that allow you to manipulate data and schema in an Oracle database. Subroutine libraries supporting the OCI are offered for most popular high-level programming languages. As Figure 1 - 1 shows, you compile and link an OCI program in the same way that you compile and link a non-database application. There is no need for a separate preprocessing or precompilation step.
Note: On some platforms, it may be necessary to include other libraries, in addition to the OCI library, to properly link your OCI programs. Check your Oracle system-specific documentation for further information about extra libraries which may be required.
The OCI supports all SQL data definition, data manipulation, query, and transaction control facilities that are available through the Oracle7 Server.
Additionally, the OCI allows you to process PL/SQL statements.
Figure 1 - 1. The OCI Development Process
Language Alternatives
There is a call-level interface for each of the following high-level languages:
Meant for different application areas and reflecting different design philosophies, these languages offer a broad range of programming solutions.
Note: The PL/I OCI is available only on a limited number of platforms, and is not documented in this guide. Also, because of basic differences in the Ada OCI implementation, it is documented separately in the Programmer's Guide to the Oracle Call Interface for Ada. In the remainder of this guide, references to the OCI routines do not comprise the PL/I and Ada OCIs. Consult your Oracle system-specific documentation for more information.
Special Terms
A SQL statement such as
SELECT course_name, instructor
FROM courses
WHERE quarter = 'SPRING'
AND dept = :deptno
contains the following parts:
- two select-list items: course_name and instructor
- a table name in the FROM clause: courses
- two column names in the WHERE clause: quarter and dept
- a literal input value in the WHERE clause: 'SPRING'
- a placeholder for an input variable in the second part of the WHERE clause: :deptno
When you develop your OCI application, you call routines that specify to the Oracle7 Server the address (location) of input and output variables in your program. In this guide, specifying the address of an input variable for a placeholder is called a bind operation. Specifying the address of an output variable is called a define operation. For PL/SQL, both input and output specifications are referred to as bind operations.
These terms and operations are described in detail
.
Compiling and Linking
Oracle Corporation supplies runtime libraries for most popular third-party compilers. The details of linking an OCI program vary from system to system. See Appendix G and Chapter 2 of this Guide for general information about deferred mode linking. See your Oracle system-specific documentation for more information about compiling and linking an OCI application. for your specific platform.
New OCI Routines
Several new OCI routines are being introduced in release 7.3. Each of these routines is listed below, with a reference which points to more information about the functionality provided by that routine. Routine descriptions and parameter lists are found
(for C), Chapter 5 (for COBOL) and Chapter 6 (for FORTRAN).
OPINIT
This is the new OCI process initialization call. It is described in the section "Thread Safety"
.
OBINDPS, ODEFINPS
These are new calls for binding and defining variables. They are discussed in the sections "Piecewise Insert, Update and Fetch" and "Arrays of Structures"
.
OGETPI, OSETPI
These calls are used for piecewise database operations. They are covered in detail in the section "Piecewise Insert, Update and Fetch"
.
Obsolete OCI Routines
Some OCI routines that were available in previous versions of the Oracle OCI are no longer supported for the Oracle7 OCI. They are listed below.
Obsolete OCI Routine
| Replacement in Oracle7
|
OBIND
| OBNDRN or OBNDRV
|
OBINDN
| OBNDRN or OBNDRV
|
ODFINN
| ODEFIN
|
ODSRBN
| ODESCR
|
OLOGON
| OLOG
|
OSQL
| OPARSE
|
If you have an application written for an earlier version of Oracle that uses the obsolete routines, you must recode the application using the new routines shown in the table. Alternatively, you can write interface routines to map the old calls to the new calls, allowing you to relink the application without modifying the original source code or to handle cases where the original source code is not available.
Obsolescent OCI Routines
You should not use some OCI routines that are still available with the Oracle7 OCI in new programs. Replacing each of these routines is a new routine that offers improved performance or functionality.
These older routines are described in Appendix D, E, or F of this Guide. Oracle will not support these calls in future versions of the OCI. They are as follows:
Older OCI Routine
| Recommended for New Oracle7 Programs
|
ODSC
| ODESCR
|
OERMSG
| OERHMS
|
OLON
| OLOG
|
ORLON
| OLOG
|
ONAME
| ODESCR
|
OSQL3
| OPARSE
|