Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with OCI

Re: Problem with OCI

From: Bjørn Augestad <b-augest_at_online.no>
Date: Mon, 21 Jun 1999 08:02:04 +0200
Message-ID: <376DD55C.B6A4AA30@online.no>


Hi,

It is hard to tell without seeing the code, but your friend should change the C variable col1 from char[4] to char[5]. OCI needs a place to put the string terminating zero. It may be that OCI, which needs 5 bytes to store col1, overwrites the col2 variable (partially?) with the zero byte.

HTH
Bjørn

Bruno Thomas wrote:

> Hello.
>
> A friend has a problem with OCI. He sents me this message :
>
> > I'm writting a C program under Windows 95 which use the Oracle Call
> > Interface
> > to access my Oracle DataBase.
> > I'm implementing, for example, on a table Foo :
> > "create table Foo
> >
>
> > col1 char(4),
> > col2 number(2),
> > col3 number(9)
> > constraint PK_Foo primary key (col1)
> > )"
> >
> > a "SELECT col1, col2, col3 from Foo;" binding each column to allocated C
> variables
> > char[4] col1,
> > short col2,
> > double col3.
> >
> > The bind is made during cursor opening.
> >
> > While fetching my select cursor, it happends that col1 and col3 are right
> loaded, but col2
> > which takes 0 instead of a non null value.
> > I'm compiling my program with Borland C++ version 5.0A with the Borland
> dynamic runtime library
> > and the specific OCI borland library (v 7.3) brought to developer with
> SQL*Net v7.3.
> >
> > Does anybody know anything about that ?
>
> Thanks in avance.
> --
> Bruno Thomas
> nospam_at_francemel.com est ma véritable adresse
> nospam_at_francemel.com is my real address
Received on Mon Jun 21 1999 - 01:02:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US