dbTalk Databases Forums  

debugging program using GOTO heavily

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss debugging program using GOTO heavily in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
seanj
 
Posts: n/a

Default debugging program using GOTO heavily - 12-13-2004 , 10:52 AM






LOOP
BEGIN

GOTO INSERTREC
......

GOTO UPDATEREC
......

GOTO DONEXTREC
......


<<INSERTREC>>
....
NULL;


<<UPDATEREC>>
.....
NULL;


<<DONEXTREC>>
.....
NULL

END;

? WHEN PROCEDURE BRANCHES TO <<INSERTREC>> will the code in UPDATEREC
and Get executed unless i explicitly tell it to GOTO DONEXTREC


Reply With Quote
  #2  
Old   
Rauf Sarwar
 
Posts: n/a

Default Re: debugging program using GOTO heavily - 12-13-2004 , 02:58 PM






Try it. Put a dbms_output after every goto label and see what gets
executed.

Regards
/Rauf


Reply With Quote
  #3  
Old   
Mark C. Stock
 
Posts: n/a

Default Re: debugging program using GOTO heavily - 12-13-2004 , 06:55 PM




"seanj" <seanjones (AT) optonline (DOT) net> wrote

Quote:
LOOP
BEGIN

GOTO INSERTREC
.....

GOTO UPDATEREC
.....

GOTO DONEXTREC
.....


INSERTREC
...
NULL;


UPDATEREC
....
NULL;


DONEXTREC
....
NULL

END;

? WHEN PROCEDURE BRANCHES TO <<INSERTREC>> will the code in UPDATEREC
and Get executed unless i explicitly tell it to GOTO DONEXTREC

avoid GOTO at all costs -- it always leads to poorly structured code

specific to your question, GOTO is not like a CASE or SWITCH statement (CASE
is supported in 9i, it would be a good alternative to GOTO) -- once PL/SQL
'goes to' there is no lingering or implied effect... code is processed
sequentially until another control structure is reached

++ mcs




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.