Re: Novice OCI questions (2)

From: Gert Rijs <gem_at_wirehub.nl>
Date: 1997/05/03
Message-ID: <01bc579e$923976a0$525fa5c2_at_gertrijs>#1/1


> 1. When I try to retrieve records using the OCI library, I seem to
> not get back records that have null values in the fields which I am
 <snip>
>
> if ( oparse (&CDA,(text *)"select name,address from person_table",
> (sb4)-1,(sword)PARSE_DEFERRED,(ub4)V7_BEHAVIOR) )
> handleError (&LDA,&CDA,"oparse - parsing the query");
>
> if ( odefin (&CDA,(sword)1,(ub1 *)newPerson.name,
> (sword)sizeof (newPerson.name),
> (sword)STRING_TYPE,(sword)-1,NULL,NULL,(sword)-1,
> (sword)-1,&lenName,&codeName) )
> handleError (&LDA,&CDA,"odefin - name");
> if ( odefin (&CDA,(sword)1,(ub1 *)newPerson.address,
> (sword)sizeof (newPerson.address),
> (sword)STRING_TYPE,(sword)-1,NULL,NULL,(sword)-1,
> (sword)-1,&lenAdd,&codeAdd) )
> handleError (&LDA,&CDA,"odefin - address");

you use odefin two times for the same field (second parameter for this call should be 2)

>
> if ( iReturnCode = oexfet (&CDA,(ub4)1,(sword)0,(sword)0) )
> handleError (&LDA,&CDA,"oexfet - executing and fetching");

oexfet executes the query AND fetched the first row

> while ( iReturnCode == 0 ) {
> iReturnCode = ofetch (&CDA);

this fetches the second (third etc.) row

> }
>
> 2. According to the manual I have (Oracle Developer Guide), I should
> be able to fetch until I get CDA.rc equal to 1403. However, I never
> get CDA.rc non-zero, even if there are no records retrieved. So I
> have just been fetching until the return code from fetch went
> non-zero, which *it* does when there are no more records. So, uh, is
> this right?
>
cda.rc should equal 1403.

hth,

        Gert Received on Sat May 03 1997 - 00:00:00 CEST

Original text of this message