I read it from the book "Relational Database Systems" by Dan A. Simovici, Richard L. Tenney, published by Academic press, in 1995.
In chapter 4, Embedded SQL, on page 153, after the above code (I changed lab to l), in the second last paragaph, it says:
"The scope of the first whenever extends to the statement that precedes the second whenever. If an error occurs in the select statement, the execution wll jump to the statement labeled lab2. The jump goto lab7 that will make the control flow bypass the second select has no impact whatsoever on the effect of the second whenever on the select, because the scope of any whenever has a strictly lexical, static character."
From the above explanation, my understanding is that the second whenever will apply after l7 and onwards.
I want to make sure that my understanding is correct. That's why I asked this. I tried to search for it in the esql documentation of Ingres but couldn't find.