| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> oracle 10g pro*c error (ORA-24374 )
Hi, all
I meet a question in oracle 10g when do some pro*c code. ora-24374:define not done before fetch or execute and fetch...
here's my c++ code:
Recordset::select()
{
EXEC SQL BEGIN DECLARE SECTION;
char szsqlstament[10240]; char colname[50]; char colvalue[1024]; int coltype; int collength; int numcols = 0; int numrows = 0;
char szpwd[10];
char szsid[10];
EXEC SQL END DECLARE SECTION;
strcpy(szusr,"xxx");
strcpy(szpwd,"xxxx");
strcpy(szsid,"xxx");
strcpy(szsqlstament, psqlstr);
pRecorder = new char **[pmaxrows];
int aa;
char abc[2000];
EXEC SQL CONNECT :szusr identified by :szpwd using :szsid;
strcpy(abc,sqlca.sqlerrm.sqlerrmc);
aa=sqlca.sqlcode;
printf("%s\n",abc);
aa=sqlca.sqlcode;
printf("%s\n",abc);
while (sqlca.sqlcode == 0)
{
exec sql fetch c2 into descriptor 'big_desc'; -----error here!
strcpy(abc,sqlca.sqlerrm.sqlerrmc);
aa=sqlca.sqlcode;
printf("%s\n",abc);
if (sqlca.sqlcode == 0)
{
exec sql get descriptor 'big_desc' :numcols = count;
pRecorder[numrows] = new char *[numcols];
for (index_colcnt=1; index_colcnt<=numcols; index_colcnt+
+)
{
exec sql get descriptor 'big_desc'
value :index_colcnt :colname = name,
:coltype = type,
:collength
= length;
exec sql get descriptor 'big_desc'
value :index_colcnt :colvalue =
pRecorder[numrows][index_colcnt - 1]=new char[collength];
if (!pRecorder[numrows][index_colcnt - 1]) cout << "new string
fail!" << endl;
strcpy(pRecorder[numrows][index_colcnt - 1], colvalue);
}
numrows++;
}
}
cout <<"sqlcode=%d,sqlerrmc=
rdcolumncount = numcols;
rdrownumber = numrows;
exec sql close c2;
exec sql deallocate descriptor 'big_desc';
return 1;
}
and this is my tnsadmin.ora
abc =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora-server)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =abc)
proc.exe dynamic=ansi lib.cpp code=cpp oname=lib.c Received on Fri Apr 13 2007 - 07:39:02 CDT
![]() |
![]() |