Re: PROC and OCI Beginner's Questions
Date: Thu, 20 Jan 1994 06:09:07 GMT
Message-ID: <tssmithCJwzr8.Jrn_at_netcom.com>
In article <1994Jan19.092745.12420_at_janix.pcs.dec.com> egerton_at_pcs.dec.com (Jim Egerton Digital-PCS GmbH) writes:
>Hello,
> I'm new to Oracle and have a few questions regarding the use of
>PROC and OCI:
>1) Is there an embedded DISCONNECT?
Sure. The embedded SQL command is RELEASE. You can issue this with either the ROLLBACK or COMMIT option, with obvious consequences. See chapter 6 in the _Programmer's Guide to the Oracle Precompilers_ for more details. If you exit your Pro*C program with out saying RELEASE, all uncommitted transactions are rolled back. Beware, this may not be what you wanted.
>2) When PROC is invoked with MODE=ANSI the SQLCODE values are different
> then the OCI codes returned for the same SELECT statements. Is there
> some way to map the OCI values to be the same as the MODE=ANSI values?
Since the OCIs, unlike the precompilers, are not ANSI/ISO standard, there is no MODE= switch. Note: with the precompilers, when MODE=ANSI, you get only three possible values in SQLCODE: -1 (an error occurred), 0 (success), and +100 (no data found).
The OCI values are what you'd get with a precompiler with MODE=ORACLE, except the error numbers are positive, not negative (I believe). Of course you can translate these in your app:
if (cda.rc == 1403)
cda.rc = 100;
else if (cda.rc > 0)
cda.rc = -1;
or whatever.
Note that the SQL92 entry level standard mandates an error code called SQLSTATE, which is a 5 character string (null-terminated in C). The OCI won't supply this (since it's Oracle-specific), but for the precompilers, we are told that this is the error-handling "wave of the future".
--Tim (tssmith_at_netcom.com) (tssmith_at_oracle.com) Received on Thu Jan 20 1994 - 07:09:07 CET