Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003

    Unhappy Unanswered: Fetch type out of range

    They have upgraded the ODBC driver from to
    I am getting an error "Fetch type out of range".
    Any leads on what could be causing the error?

    I'm using the following...

    retcode = SQLBindParameter(m_hStmt,
    ++nCount, SQL_PARAM_INPUT, SQL_C_CHAR , SQL_LONGVARCHAR, nClobLen, 0, pClob , nClobLen, (long *)&nClobLen);

  2. #2
    Join Date
    Nov 2003
    down on the cube farm, left then right then another left
    I find it interesting that this error did not show up until you upgraded. Typically what I have encountered as the cause of your error is that the program is using a cursor (explicit or implicit) to fetch records and performing a commit after the first fetch and before the last. That is to say {pseudo code}

    for recs in table
    fetch rec
    commit rec

    One fix is to fetch in blocks of records (array fetch) and commit that block before fetching another. This method has the additional benefit of being more efficient.

    while whatever
    fetch 10 records
    update the info

    Another had something to do with fetch "for update" but I do not remember the particulars. It has been awhile since I encountered this error so memory is a bit fuzzy. Hope this helps.

  3. #3
    Join Date
    Nov 2003



    After some more tests, I've discovered that the query does not give the "Fetch type out of range" error if the min() is removed -

    select NE, OP_TYPE, PRIORITY, COOKIE, EXECTIME, RETRYNO, LASTERR from QUEUE where NE = 'S10U0' and EXECTIME <= 20031216163009 and PRIORITY = ( select min(PRIORITY) from QUEUE where NE = 'S10U0' and EXECTIME <= 20031216163009 ) and rownum = 1

    Any ideas why?

    The cursor...
    SQLSetStmtAttr(m_hStmt, SQL_ATTR_CURSOR_TYPE, (void *)SQL_CURSOR_STATIC, 0) ;

    The statement giving me the Fetch type out of range error -
    retcode = SQLFetchScroll(m_hStmt, SQL_FETCH_RELATIVE, nOffSet ) ;

    Is there something wrong in the usage?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts