2 Replies Latest reply: Jul 6, 2011 7:00 AM by paulafnsc RSS

    ANSI Dynamic SQL and BLOBs in Pro*C

    283872
      I'm trying to retrieve a blob using ANSI Dynamic SQL in a Pro*C application.
      However, when I attempt to use FETCH DESCRIPTOR I get a segmentation fault.
      The precompiler picks up if the fetch size and the output structure size
      don't match, but it seems that they don't actually match according to the
      database.

      char correctedinb[GAMMA_CHANNELS*4];

      rtype = 113;
      rsize = GAMMA_CHANNELS*4;
      EXEC SQL SET DESCRIPTOR :out_desc VALUE :occurs
      TYPE = :rtype,
      LENGTH = :rsize,
      REF DATA = :correctedinb,
      REF INDICATOR = :spectrumind;
      occurs++;

      EXEC SQL FETCH g INTO DESCRIPTOR :out_desc;
        • 1. re:ANSI Dynamic SQL and BLOBs in Pro*C
          283872
          It looks like I have to resort to using an OCIBlobLocator
          as I would if not using ANSI Dynamic. I guess I assumed that
          since I specify the exact amount I want out and the type to be
          raw I wouldn't need the lob-locator. Can anyone tell me why
          the code fragment below seg faults rather than returns some
          ora/sql error?
          I'm trying to retrieve a blob using ANSI Dynamic SQL in a Pro*C application.
          However, when I attempt to use FETCH DESCRIPTOR I get a segmentation fault.
          The precompiler picks up if the fetch size and the output structure size
          don't match, but it seems that they don't actually match according to the
          database.
          char correctedinb[GAMMA_CHANNELS*4];
          rtype = 113;
          rsize = GAMMA_CHANNELS*4;
          EXEC SQL SET DESCRIPTOR :out_desc VALUE :occurs
          TYPE = :rtype,
          LENGTH = :rsize,
          REF DATA = :correctedinb,
          REF INDICATOR = :spectrumind;
          occurs++;
          EXEC SQL FETCH g INTO DESCRIPTOR :out_desc;
          • 2. Re: re:ANSI Dynamic SQL and BLOBs in Pro*C
            paulafnsc
            Hi eversaaron,
            I have the same problem that you but I can´t solve it... How did you solve it?
            Thanks!