Toad World® Forums

Formatting Cursor Loops


#1

I don’t see where in the formatter where you can specify how to format a loop. (except putting the DO/LOOP on the same line.

For example I formatted
for v_cur in (
SELECT UPPER(p.id_nam) || ‘@quest.com’ email_addr
INTO to_addr
FROM do.tabl frp,
tabl2 p
WHERE
p.cd = ‘Y’ AND
(((p.per_cd = ‘Y’) AND
(p.pter_cd = ‘N’)) OR
((p.nonemp_cd = ‘Y’) AND
(p.nonemp_ter_cd = ‘N’)))

                             )
                             loop
                                      to_addr := to_addr ||   v_cur.email_addr ||', ';
                             end loop;

Should format like this I would think:
for v_cur in (
SELECT UPPER(p.id_nam) || ‘@quest.com’ email_addr
INTO to_addr
FROM do.tabl frp,
tabl2 p
WHERE
p.cd = ‘Y’ AND
(((p.per_cd = ‘Y’) AND
(p.pter_cd = ‘N’)) OR
((p.nonemp_cd = ‘Y’) AND
(p.nonemp_ter_cd = ‘N’)))

                             )
                    loop
                        to_addr := to_addr ||   v_cur.email_addr ||', ';
                    end loop;

something like that anyway.


#2

Hi Jet,

I could not reproduce your issue. I simply put your sample code into begin-end and formatted them. The “loop - end loop” aligned to the “for” after formatting. Could you provide the whole script for me to repeat the issue? I suspect this issue is related to a broken of last update of the formatter engine.

Thanks,
Vincent


#3

yeah, I’m not sure I can duplicate it either now.

Might have been some anomaly.

I’ll keep an eye on it.

Jet