Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Dynamic SQL method 4
In article <b54a9de64ac1f1b3d72a7f6d614528d3.11184_at_mygate.mailgate.org>,
"Sylvain says...
>
>Hello everybody,
>
>I developed an application in ProC using the Oracle Dynamic SQL method 4 to
>access an Oracle database.
>
>I am trying to pass a SQL query("SELECT" statement) which works fine with
>SQL*Plus but which makes my application crashing.
>
>It is crashing when executing the following ProC query:
>"EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp"
>
>A segmentation violation is generated. When I am using a tool to track the
>problem, it gives the following stack :
>
>sqlrlc()
>sqlgd2t()
>sqlnst()
>sqlcmex()
>sqlcxt()
>
>Has someone already been involved with this problem ?
>
>Thanks for your help.
>
>Regards,
>Sylvain.
>
>
>--
>Posted from host-30.whitepj.net [63.145.241.30]
>via Mailgate.ORG Server - http://www.Mailgate.ORG
Lets see some code and the query in question. Are you coding something like this:
if ((select_dp = sqlald (size, MAX_VNAME_LEN, MAX_INAME_LEN)) == NULL )
die( "Cannot allocate memory for select descriptor." );
select_dp->N = size;
EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp; if ( sqlca.sqlcode ) return sqlerror_soft(plsql_block,__LINE__); if ( !select_dp->F ) return 0;
if (select_dp->F < 0)
{
size = -select_dp->F; sqlclu( select_dp ); if ((select_dp = sqlald (size, MAX_VNAME_LEN, MAX_INAME_LEN)) == NULL ) die( "Cannot allocate memory for select descriptor." ); EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp; if ( sqlca.sqlcode ) return sqlerror_soft(plsql_block,__LINE__);}
That should work OK.
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Fri Sep 14 2001 - 16:04:31 CDT