Pro*C not able to print orastxtc/orasfnmc/oraslnr

From: Ranga Chakravarthi <rchak_at_netcom.com>
Date: 1998/02/14
Message-ID: <rchakEoE54q.HB5_at_netcom.com>#1/1


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,

  • ranga --
    Work fascinates me ... I can sit and look at it for hours
    Ranga Chakravarthi Ph : (504) 295 1189 (H) 11555 Southfork Ave #2092 e-mail : rchak_at_netcom.com Baton Rouge LA - 70816
Received on Sat Feb 14 1998 - 00:00:00 CET

Original text of this message