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: HELP: Dynamic SQL/Pro*C++ core dumps

Re: HELP: Dynamic SQL/Pro*C++ core dumps

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 08 Feb 1999 18:35:50 GMT
Message-ID: <36c12e32.13461777@192.86.155.100>


A copy of this was sent to Ken Dougan <kdougan_at_panther.ab.ca> (if that email address didn't require changing) On Mon, 08 Feb 1999 11:18:42 -0700, you wrote:

>I am new to Oracle Dynamic SQL and I am having trouble getting a
>small test program up and running. (I'm using Oracle 7.3.3 on Solaris
>2.5.1 and it compiles and links cleanly after running cleanly with
>Pro*C 2.2.3.0.0.)
>
>PROBLEM: The attached program core dumps while opening the cursor
>(i.e. line "EXEC SQL OPEN curs1 USING DESCRIPTOR sqlda_bv;"). It
>fails on the line "sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);"
>which is part of the OPEN cursor block inserted by the Pro*C++
>precompiler. The debugger gives the following message:
>

it is the line that reads:

      sqlda_bv->V[i-1]=(char*)v_bv_int;

V[] is an array of pointers to data. You are setting the first pointer to the number 1, not to the address of a variable that contains one. Change it to:

      sqlda_bv->V[i-1]=(char*)&v_bv_int;
                              ^^

and it won't seg fault (it may still not work, haven't looked any further but you are missing the & for sure)  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Feb 08 1999 - 12:35:50 CST

Original text of this message

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