Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009

    Unanswered: Model FOR LOOP ORA-32626 ERROR

    Another one of those dead end errors.
    "illegal bounds or increment in MODEL FOR loop"

    ORA-32626: illegal bounds or increment in MODEL FOR loop

    The error message is pretty clear, and in my case it is pretty clear where the error comes from.

    In a model rules i have the following erroneous for loop:

    ANAME[FOR FINDEX from 1 to count_chars2(ANAME[1]) increment 1]

    This is just dummy code, that will be changed in due time when i get this for loop to work.
    THe problem here is the count_chars2 function.
    I have been testing this for loop, and it seems to me that i just does not like to work with user difined functions.
    If I were the substitute the user difined function for some built-in function, say Length, the model clause would work fine:

    ANAME[FOR FINDEX from 1 to LENGTH(ANAME[1]) increment 1]
    No problem here.

    I have also tried writing the dummy function count_chars2 the following way, to make sure it was no bug in my code:
    RETURN 3;

    IN this case the function does not even need any arguments it just returns an integer. But the error is still the same.

    Does anybody if one is supposed to be able to call user defined functions in the for loop? If not, the error message seems a litle out of context.
    Is it any flag that the function is missing? I've tried to put the deterministic flag, i thought i might refuse to work with non deterministic functions. But nope... I just can't seem to get this for loop to work with anything i code.

    Any help would be great.

    Thanks in advance.

    (some examples of how to use the model clause can be seen here:
    MODEL Clause: The CV() Function)

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    32626, 00000, "illegal bounds or increment in MODEL FOR loop"
    // *Cause: FOR loop allows only numeric and datetime without timezone type
    //         for bounds.  Only constants of interval and numeric types are 
    //         allowed as increment/decrement expressions.
    // *Action: Check the SQL statement and rewrite if necessary.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2009
    >"You can lead some folks to knowledge, but you can not make them think."

    Yes i can see that you were able to follow the link I gave you!
    And your point is what?

    Notice that the function count_chars2() is at the root of the problem, when it is used to define the upper bound and it returns a "numeric" value.

    Anyway, if the function count_chars2() does not please you, than consider that count_chars2 has a varchar input variable called input, and that the function return clause is:
    Return Length(input).

    With this said i ask:
    can you now "understand" the problem?
    LEGNTH('whatever') works but,
    calling a function with function body RETURN LENGTH('whatever'); does not!
    This last approach will result in the same error.

    So, the point here is: the upper bound of the For Loop expression can be obtained from a Built-in function but can not be obtained from an equivalent user defined function.
    That is the only issue here. I thought it was explicit from the start, but maybe i should have been clearer.

    On a side note: When you quote someone, namely in your signature, always remember to put the "": otherwise, someone may mistake knowledge that is not yours, for yours. As unlikely it may sound...
    Last edited by 99sono; 06-17-09 at 04:03.

Posting Permissions

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