Fetching from LONG in Pro*C

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pedro Oguri

    Fetching from LONG in Pro*C

    How can I fetch a LONG type into a C variable using Pro*C compiler?
    What´s wrong with this code?

    typedef struct TAGmy_raw
    {
    long len;
    unsigned char arr[2000000];
    }
    my_raw;

    EXEC SQL BEGIN DECLARE SECTION;
    EXEC SQL TYPE my_raw IS LONG;
    my_raw buffer;
    EXEC SQL END DECLARE SECTION;

    EXEC SQL SELECT LONG_COLUMN
    INTO :buffer
    FROM TABLE_X
    WHERE ID=1;

    The code, compiles and executes it.
    But buffer.len and buffer.arr return all zeroed

    This insertion code works OK though:
    EXEC SQL
    INSERT INTO TABLE_X (LONG_COLUMN)
    VALUES (:var);

    Any help?
    Tks,
    Pedro Oguri
  • anacedent

    #2
    Re: Fetching from LONG in Pro*C

    Pedro Oguri wrote:
    How can I fetch a LONG type into a C variable using Pro*C compiler?
    What´s wrong with this code?
    >
    typedef struct TAGmy_raw
    {
    long len;
    unsigned char arr[2000000];
    }
    my_raw;
    >
    EXEC SQL BEGIN DECLARE SECTION;
    EXEC SQL TYPE my_raw IS LONG;
    my_raw buffer;
    EXEC SQL END DECLARE SECTION;
    >
    EXEC SQL SELECT LONG_COLUMN
    INTO :buffer
    FROM TABLE_X
    WHERE ID=1;
    >
    The code, compiles and executes it.
    But buffer.len and buffer.arr return all zeroed
    >
    This insertion code works OK though:
    EXEC SQL
    INSERT INTO TABLE_X (LONG_COLUMN)
    VALUES (:var);
    >
    Any help?
    Tks,
    Pedro Oguri
    Google is your friend!


    Comment

    Working...