RE: Re: Code Analysis false positives for dead code with case statement
Bert Scalzo <[email protected]>
| Newsgroups | gmane.comp.db.oracle.toad.free |
|---|---|
| Message-ID | <228D4BD15697E04CAF6CD482362F2ACE1041B6F1@ALVMBXW01.prod.quest.corp> |
Interesting coding style - I am not saying anything is wrong - but sure looks like a fancy goto to me :) From: [email protected] [mailto:[email protected]] On Behalf Of Gregory Liss Sent: Friday, June 22, 2012 7:42 AM To: [email protected] Subject: RE: [toad] Re: Code Analysis false positives for dead code with case statement You found another legacy rule. :( -----Original Message----- From: [email protected]<mailto:toad%40yahoogroups.com> [mailto:[email protected]<mailto:toad%40yahoogroups.com>] On Behalf Of Jonathan Sent: Friday, June 22, 2012 08:33 AM To: [email protected]<mailto:toad%40yahoogroups.com> Subject: [toad] Re: Code Analysis false positives for dead code with case statement I think I've found another issue this time with rule 2601: Ensure locally opened cursors will be closed. I believe that in this code snippet it is incorrect in saying the rule fails (I've built this example using the structure of some production code we have) because as far as I can tell the cursor will be closed either at the end of the loop or if the exception is raised. CREATE OR REPLACE PROCEDURE testproc (x IN PLS_INTEGER) AS CURSOR testcur IS SELECT * FROM DUAL; testrec testcur%ROWTYPE; testexception EXCEPTION; BEGIN OPEN testcur; LOOP FETCH app_cur INTO app_rec; EXIT WHEN app_cur%NOTFOUND; IF x = 1 THEN BEGIN --Some code NULL; EXCEPTION WHEN OTHERS THEN RAISE testexception; END; ELSE BEGIN --Some code NULL; EXCEPTION WHEN OTHERS THEN RAISE testexception; END; END IF; END LOOP; CLOSE testcur; EXCEPTION WHEN testexception THEN CLOSE testcur; END; Am I correct that this code is okay and shouldn't be failing this rule? Regards, Jonathan ------------------------------------ Yahoo! Groups Links