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 -> SQLDA, Dynamic SQL Method 4 and output host variables

SQLDA, Dynamic SQL Method 4 and output host variables

From: Alex Vinokur <alexander.vinokur_at_telrad.co.il>
Date: Tue, 19 Oct 1999 09:19:08 GMT
Message-ID: <7uhd26$vtg$1@nnrp1.deja.com>


Hi,

I need something like this :

//#########################################################
//------------------- Pro*C++ code : BEGIN ----------------


void foo (const vector<string>& out_variables_names_i) {

//=============================================================

// Number of of output host variables is unknown until run time
//=============================================================
        // stuff

        for(; ; ;)
        {
                // stuff

                //====================================================
                EXEC SQL FETCH the_cursor INTO <out_variables_names_i>;
                //====================================================

                // stuff
        }  // for

        // stuff

} // void foo (const vector<string>& out_variables_names_i)
//------------------- Pro*C++ code : END ------------------
//#########################################################



//#########################################################
//-------------- Problem Description : BEGIN --------------
  1. Do *Dynamic SQL Method 4* and *SQLDA (SQL Descriptor Area)* enable to gain it?
  2. If they do enable to do it { Do we have to use bind variables or another types? How to use relevant types? }

Any hints and examples would be appreciated.

        Alex

//-------------- Problem Description : END ----------------
//#########################################################



//#########################################################

// From : Pro*C/C++ Precompiler Programmer's Guide : BEGIN
// ---- : Release 8.0
// ---- : A58233-01
//========= From : #13 Using Dynamic SQL =========

// Using Method 4 -> Need for the SQLDA
// Page#13-25

   To process the dynamic SQL statement,    your program must issue the DESCRIBE BIND VARIABLES command and    declare another kind of SQLDA called a bind descriptor    to hold descriptions of the placeholders for input host variables.    (Input host variables are also called bind variables.)

        !!! Question : Do bind variables care only
        !!!            for input host variables?
//================================================

//========= From : #13 Using Dynamic SQL =========

// Using PL/SQL -> With Method 4
// Page#13-30

   If the PL/SQL block contains an unknown number    of input or output host variables, you must use Method 4.    To use Method 4, you set up one bind descriptor    for all the input and output host variables.

        !!! Question : Do bind variables have to do
        !!!            with output host variables?
        !!! See above :
        !!! (Input host variables are also called bind variables.)
   Executing DESCRIBE BIND VARIABLES stores information    about input and output host variables in the bind descriptor.    Because the precompiler treats all PL/SQL host variables    as input host variables,
   executing DESCRIBE SELECT LIST has no effect.
//================================================

//= From : #14 Using Dynamic SQL: Advanced Concepts

// Understanding the SQLDA -> Purpose of the SQLDA
// Page#14-4, 14-5

   Method 4 is required for dynamic SQL statements    that contain an unknown number of select-list items or    placeholders for bind variables.
   To process this kind of dynamic SQL statement,    your program must explicitly declare    SQLDAs, also called descriptors.
   Each descriptor is a struct
   which you must copy or hardcode into your program.    A select descriptor holds descriptions of select-list items,    and the addresses of output buffers where the names and    values of select-list items are stored.    [snip]
   A bind descriptor holds
   descriptions of bind variables and indicator variables,

        !!! Question : Can bind descriptor hold
        !!!            descriptions of output host variables?
        !!! If bind descriptor can't do it,
        !!! why are indicator variables mentioned here?
   and the addresses of input buffers where    the names and values
   of bind variables and indicator variables are stored.
//================================================

// From : Pro*C/C++ Precompiler Programmer's Guide : END --

//#########################################################


//#########################################################
//------------------- Environment -------------------------

=== Oracle 8.0.5

=== Pro*C/C++ : Release 8.0.5.0.0
=== SunOS 5.6
//---------------------------------------------------------

//#########################################################



Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Oct 19 1999 - 04:19:08 CDT

Original text of this message

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