Improved PL / SQL readability for identifying LOOP and single blocks

I am relatively new to PL / SQL (Oracle). I can successfully complete my task. After modular programming, I split my program into small PL / SQL blocks. In addition, I have nested BEGIN-ENDcode. (For exception handling)

When my code base began to grow, I could see many nested blocks inside, and I could not identify the corresponding ENDfor each block BEGIN. (When the blocks are larger). The same case with nested FOR LOOPtoo. I agree that there are no curly braces in PL / SQL.

I have improved the indentation of my code as much as possible, and to some extent the code can now be read. But still, if someone else wants to read my code, I get the feeling that my code may not be easy to pass.

Do you guys offer any suggestions to solve my problem?

+4
source share
2 answers
 <<outer_loop>>
 LOOP
   <<<block1>>
   BEGIN
       i := i + 1;
       j := 0;
       <<inner_loop>>
       LOOP
         -- Your Statements
         EXIT inner_loop WHEN (j > 5);
         EXIT outer_loop WHEN ((i * j) > 15);
       END LOOP inner_loop;
   END block1;
 END LOOP outer_loop;

Try using LABELS(built in angle brackets). This should help you! You can search for shortcut names where the loop / loop begins or ends!

Actually, this kind of tag can also be used to GOTO

But do not use it, as it also confuses you :)

Good luck

+2
source

. , .

1) PL/SQL- . .

2) PL/SQL ( SQL, PL/SQL, TOAD, SQL Navigator). , mathincg , ..

+1

All Articles