Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Pro*C not able to print orastxtc/orasfnmc/oraslnr
Hi,
I am having trouble getting the oracle statement, filename and line number of the SQL statement from the oraca structure.
This is the piece of code I use in my Pro*C program :
#include <oraca.h>
..
main() {
oraca.orastxtf = ORASTFANY;
EXEC SQL WHENEVER SQLERROR DO sql_error("Select error");
.. select statement goes here ..
.
}
void sql_error(char *msg) {
printf("\n%s", msg);
sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0'; oraca.orastxt.orastxtc[oraca.orastxt.orastxtl] = '\0'; oraca.orasfnm.orasfnmc[oraca.orasfnm.orasfnml] = '\0'; printf("\n%s\n", sqlca.sqlerrm.sqlerrmc);printf("in \"%s...\"\n", oraca.orastxt.orastxtc); printf("on line %d of %s.\n\n", oraca.oraslnr,
oraca.orasfnm.orasfnmc);
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL ROLLBACK RELEASE;
exit(1);
}
When I compile and run the program this is what I get :
Select error.
ORA-01722: invalid number
in "..."
on line 0 of .
Why am I not getting the orastxtc and orafnmc strings in the output? BTW, the sql_error() function is a cut&paste from proc/demo/sample8.pc I have tried ORASTFERR for oraca.orastxtf. No use!! Could anybody please help me understand what is going on here? Is there any special flags that need to be passed to the precompiler?
TIA,
![]() |
![]() |