Search code examples
coracle-databaseoracle-pro-c

Pro*C char copying (ORACLE DB)


I want to copy a char onto a CHAR(18 BYTE) from my ORACLE Database:

myfunction(char *idnr)
{
    EXEC SQL BEGIN DECLARE SECTION;     
    char* idn;
    EXEC SQL END DECLARE SECTION;

    strcpy(idn,idnr);
...}

but it seems it doesn't work


Solution

  • char* idn;
    

    First of all you need to allocate memory for it or Use array instead

     char idn[strlen(idnr) + 1];