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: C structures in Pro*C???

Re: C structures in Pro*C???

From: Ian Parkin <twod_at_roxy.sfo.com>
Date: 1997/03/28
Message-ID: <5hfg89$c19@ramona.sfo.com>#1/1

Z. Martinez (zlm101_at_psu.edu) wrote:

Have a look at the sample Pro*C code that Oracle ships with the proc compiler. The majority of your questions are somewhat dependant on the version of Pro*C that you are using - newer versions allow more natural use of C structs, whereas older ones do not.

: struct trn
: {
: char id [6];
: char type [2];
: char desc [41];
: double qty;
: }

I always prefer VARCHAR, or better still datatype equivalencing, to plain old char[]. Makes it easier when reading data in/out of the db.

: One specific question is, do I need to null terminate the "id" field
: (which means I have to declare it as "char id [7]"),
: or does Pro*C just get the first 6 characters of id??

It is best to declare as length + 1 (for the null terminating character). Also, what does it do if the field is only 3 chars long !

: And how do I declare my EXEC SQL statement??

Newer versions don't require this section if mode=oracle.

: Please send your response to zlm101_at_psu.edu

Answered in the same forum that you asked your question.

IAP Received on Fri Mar 28 1997 - 00:00:00 CST

Original text of this message

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