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 -> Passing host arrays as args to subroutines: Pro*C

Passing host arrays as args to subroutines: Pro*C

From: Denis M. Goddard <d.m.goddard_at_cummins.com>
Date: 1997/01/08
Message-ID: <32D33686.5954@cummins.com>#1/1

Hello Oracle / Pro*C Gurus...

I would like to code a function that will select rows from Oracle and return them in a hostarray that was passed to the function.

Yes, I realize the easiest/best way to do that would be using a packaged, parameterized cursor and FETCHing from it directly into the host array. Just take it on faith that I really don't want to do that.

#include <grovel.h>
I am forced to admit my ineptitude in C.... your insight will be greatly appreciated....

What I want to do is:

common_oracle_functions.h:

/* --- function prototype, i.e., in a header file --- */
/* function populates fetched_rows host array */
/* and returns sqlca.sqlerrd[2] */

int Fetch_Data ( char *arg1, ...      /* modify selection logic, etc. */
                 VARCHAR *fetched_rows   /* ???? populate this        */
               );

===================================

specific_application_program.c:

/* Declare Host Array */

EXEC SQL BEGIN DECLARE SECTION;
  VARCHAR DB_Rows [ 50 ] [ 256 ]; /* at most 50 VARCHAR values */ EXEC SQL END DECLARE SECTION; Received on Wed Jan 08 1997 - 00:00:00 CST

Original text of this message

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