Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> dbms_sql
I have some problems with dynamic SQL. I use the dbms_sql package to
dynamically create an sql query. With the define_column, fetch_rows and
column_value procedures/functions I seem to get just about the correct
data... at least when I test my procedure from SQL*PLUS. When I try to
call the procedure from outside Oracle, through ODBC, I run into an
ORA-06512. I've tracked down the bug to the column_value function, but to
be honest, I have absolutely no idea what to do about it.
Here's a few lines from the code, just to illustrate what I'm doing;
nCursorId := dbms_sql.open_cursor;
dbms_sql.parse(nCursorId, sSqlStatement, dbms_sql.native); dbms_sql.define_column(nCursorId, 1, gFirstName, 20); dbms_sql.define_column(nCursorId, 2, gLastName, 20);
nRows := dbms_sql.execute(nCursorId);
nRows := dbms_sql.fetch_rows(nCursorId);
while nRows = 1 loop
dbms_sql.column_value(nCursorId, 1, gFirstName); dbms_sql.column_value(nCursorId, 2, gLastName);
It's the two last lines that causes the error...
/Mikael Received on Wed Apr 22 1998 - 21:07:44 CDT
![]() |
![]() |