Have you ever notice this? I'll try to explain it in code:
without the IF (tmp_b = 10) THEN LEAVE. PROGRESS will run forever though I only have one record.....
I'm stuck for hours because of this PROGRESS behavior. I don't know about other DBMS.
I just want to share to everyone, just be very carefull with your index...
Doing things like above make me feels silly because I should've change my Index value...
Though I only wanted progress to returns one record, I will get unlimited loop for the result...
Code:
DEF TEMP-TABLE tmp_table
FIELD tmp_a as char
FIELD tmp_b as int
INDEX tmp_idx1 is primary unique tmp_a
INDEX tmp_idx2 tmp_a tmp_b.
CREATE tmp_table.
SET tmp_a = "A"
tmp_b = 1.
MESSAGE "LETS START CONFUSING LOOP" VIEW-AS ALERT-BOX.
FOR EACH tmp_table WHERE tmp_a = "A" USE-INDEX tmp_idx2.
SET tmp_b = tmp_b + 1.
MESSAGE "THIS IS OLD" tmp_b.
IF (tmp_b = 10) THEN LEAVE.
end.
MESSAGE "LETS START OUR REAL LOOP" VIEW-AS ALERT-BOX.
FOR EACH tmp_table WHERE tmp_a = "A" USE-INDEX tmp_idx2.
MESSAGE "THIS IS NEW" tmp_b.
END.
I'm stuck for hours because of this PROGRESS behavior. I don't know about other DBMS.
I just want to share to everyone, just be very carefull with your index...
Doing things like above make me feels silly because I should've change my Index value...

Though I only wanted progress to returns one record, I will get unlimited loop for the result...