Hey. I have a question about looping in SQL. I want to convert some given logic into SQL language (I am new to SQL). I am wondering whether it is possible to put the loop inside a CASE WHEN statement ? If anyone knows please consult me on this The original logic i am working with is this:
"IF v1=1 AND v2<>333 READ EACH v3 OCCURRENCE UNTIL YOU LOCATE THE 1ST OCCURRENCE WHERE v4=2 AND v5<=v6 THEN MOVE v7 ELSE MOVE v8".
I start converting into SQL syntax: " CASE WHEN v1=1 AND v2<>333... " and then not sure how to proceed.