Q
Problem solve Get help with specific problems with your technologies, process and projects.

Error using FETCH ABSOLUTE in scrollable cursor

We are using DB2 V7 on OS/390 and trying scrollable cursors in a stored procedure. When we try to use the FETCH statement like:
    FETCH ABSOLUTE 
  
    FROM 
   
     INTO 
    
     ; 
    
   
  
it's throwing for the host variable and saying "variable should be zero scale." I had declared the variable as an INTEGER, and I even tried it with DECIMAL(n,0), but I get the same error.

Well, it sounds like your query should work. When a host variable is used with the ABSOLUTE form of the FETCH with...

scrollable cursors, the host variable must be an exact numeric type with zero scale and must not include an indicator variable. Did you include an indicator variable? (Probably not, but I had to ask.)

The possible data types for the host variable are DECIMAL(n,0) or INTEGER. The DECIMAL data type is limited to DECIMAL(18,0). Try substituting an integer constant in the stored procedure just to see if that works. If it does, try the integer variable again. If you continue to get the same problem I suggest that you post this problem with IBM technical support - it could be a bug.

This was last published in October 2002

Dig Deeper on IBM DB2 management

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchAWS

SearchContentManagement

SearchOracle

SearchSAP

SearchSQLServer

Close