Re: ProC and dynamic selects using SQLDA?

From: Steve Phelan <stevep_at_pmcgettigan.demon.co.uk>
Date: 1997/03/11
Message-ID: <33252E4E.174D_at_pmcgettigan.demon.co.uk>#1/1


Ken Frank wrote:
>
> Does anyone out there have any references on doing dynamic select
> statements (with completely unknown result-sets) under ProC? I need
> to duplicate some stuff I wrote for Ingres to work under Oracle, but
> can't find any documentation on how to do this. Even Oracle's own
> manual (the one claiming to be for C programmers) states that it's an
> advanced topic, and not covered.
>
> Under Ingres, the basics look like:
>
> exec sql declare stmt statement;
> exec sql declare :cursorname cursor for stmt;
> exec sql prepare stmt from :qrystr;
> sqlda = sqlda_new(MAX_ELEMS);
> exec sql describe stmt into :sqlda;
>
> /* allocate result-vars */
> for (i = 0; i < sqlda->sqld; i++) {
> sqv = &sqlda->sqlvar[i];
> [
> big switch on sqv->sqltype, with calls to allocate space for
> appropriate result-types and null-indicators omitted ...
> ]
> }
>
> exec sql open :cursorname;
> ...
>
> That's the basics under Ingres, anyways. Can anyone give me some
> tips for Oracle? I'd like to stay away from OCI if possible.
>
> Thanks in advance!
> Ken Frank
> kenf_at_usinternet.com
>
> PS - Is it just me, or is a post to this newsgroup pretty much
> guaranteed to get you on every spammers mailing list?
There is a separate Pro*C Supplement manual that details all methods of dynamic sql. It contains examples of what you require. Ask you local Oracle reseller for a copy (sorry, haven't got the part number to hand - but have a look if it's on you Oracle documentation CD).

Steve Phelan. Received on Tue Mar 11 1997 - 00:00:00 CET

Original text of this message