Should one use OCI or the Oracle Precompilers?

OCI is superior to Pro*C in the following ways:

  • Performance is much better with OCI
  • Reduced code size
  • Direct access to built-in functions (No intermediate files or substitutions).
  • Piecewise Operation on LONG fields (All LONG field problems are solved)
  • In Pro*C one cannot dynamically allocate memory to be used as bind variables
  • You cannot control the Pro*C precompiler to provide better and more compilable C-code.
  • etc...

Common problems with OCI:

  • OCI code is difficult to write and to maintain
  • Very few people can write, let alone maintain OCI code
  • etc...

An OCI application program must do the following:

  • Connect to one or more databases: call the OCILogon (olog, olon or orlon) routines
  • Open the cursors needed by the program: use oexec, oexn, ofen or oftech calls.
  • Process the SQL statements that are needed to perform the application's tasks.
  • Close the cursors using the oclose routine.
  • Disconnect from the databases: use ologoff to close an open connection to oracle.