Home » Developer & Programmer » Precompilers, OCI & OCCI » Pro *C Fetch Into Host Array
icon4.gif  Pro *C Fetch Into Host Array [message #137765] Fri, 16 September 2005 11:17 Go to next message
felipevinturini
Messages: 10
Registered: August 2005
Location: Brazil
Junior Member

Hi All Pro *C Experts,

I am facing a problem while fetching the result of Select Statement.

Let me explain:
- I have table "A" with two columns: First and Second with the following values:
First Second
1 11
2 22
3 33

And I want to fetch the values above.

I have some questions about it:
1. Talking about performance, where is better to fetch the values above, in two arrays of char or in one struct?
2. How do I fetch the values above to an array and/or struct?
3. How do I work with this values? For example, print the array?
printf("Value: ...");

Is there a site, a document where I can read about it an find examples?

Thanks for your help.
Felipe.
Re: Pro *C Fetch Into Host Array [message #138432 is a reply to message #137765] Wed, 21 September 2005 23:47 Go to previous message
Dropbear
Messages: 4
Registered: September 2005
Junior Member
The pro*C docco has a whole section on host arrays. it's all in there..

basically

EXEC SQL BEGIN DECLARE SECTION;
int id[30]; // array of 30 ints
EXEC SQL END DECLARE SECTION;

..
EXEC SQL FETCH cursor_name INTO :id;

Oracle knows ID is an array and so does a bulk fetch..

I always use structures when fetching multiple columns.. it's neater..

Previous Topic: Problem using Oracle OCCI and Signal Handling
Next Topic: Doubt in OCCI
Goto Forum:
  


Current Time: Sun Jul 12 02:46:21 CDT 2020