Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ODBC SQL NULL conversion

Re: ODBC SQL NULL conversion

From: Wat Hughes <wat_at_credata.com>
Date: 1996/12/04
Message-ID: <32A59ECB.58E2@credata.com>#1/1

I have not tried NULL with input/output parameters, but I have had success with each input and output parameters. Here is a code excerpt:

        if (current->IsNull())
        {
            pcbValue = (SDWORD *) &current->GetDriverData1();
            *pcbValue = SQL_NULL_DATA;
        }

        RETCODE retcode = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT,
                                           cType, sqlType,
                                           precision, scale, ptr,
                                           cbValueMax, pcbValue);
        if (!resultsHandler(retcode))
        {
            return false;
        }

Ed. Doesburg wrote:
>
> ODBC SQL NULL conversion
> -------------------------------------------
>
> * General structure:
>
> Within the Visual C++-code, calls are made to Oracle PL/SQL procedures,
> stored in a database. To accomplish this, ODBC is used for type conversion.
> The stored procedures consist of a number of parameters, which can be
> input, output or input/output parameters. In some cases the input/output
> parameters require (SQL) NULL values for input. The output value of these
> parameters could either be a NULL value or a real value.
>
> * ODBC mechanism, and possible solution:
>
> ODBC offers a function, called SQLBindParameter, that can be used to bind
> application parameters to to parameter markers in a SQL statement. One of
> the arguments in SQLBindParameter is called PCBVALUE; this (pointer)
> argument could contain the value SQL_NULL_DATA. This would mean that the
> PL/SQL parameter receives a SQL NULL value.
>
> * Problem:
>
> It doesn't seem possible to pass an input/output parameter from Visual C++
> through ODBC to PL/SQL with the SQL value NULL, not even with the
> SQLBindParameter function.
>
> * Questions:
>
> 1. Is it possible to pass an input/output parameter from Visual C++ through
> ODBC towards PL/SQL wich contains a SQL NULL value, and could this
> parameter then receive a NULL value or a real value?
> 2. Must this be done with SQLBindParameter?
> 3. If so, how does this work? Could you give an example?
> --
> Ed. Doesburg
> edd_at_worldonline.nl
  Received on Wed Dec 04 1996 - 00:00:00 CST

Original text of this message

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