Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Minimising deep indentation

Re: Minimising deep indentation

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 21 May 2005 13:04:15 -0800
Message-ID: <428f943f@news.victoria.tc.ca>


dn.perl_at_gmail.com (dn.perl_at_gmail.com) wrote:

: I have taken over some PL/SQL code which is deeply indented.
: Some lines have 10-12 tabs before code appears on them. I want
: to minimise this. I don't even mind introducing an
: "indent_help_exception" for this purpsoe.

: If my entire code is trapped within if not(date_cycle is null),
: then I want to trap if(date_cycle is null) case first.

: current code :
: if (condition1) then
: register a small 'error' message ;
: else
: a block of 300 lines; -- which later has deep indents needing
: 10-12 tabs
: end if ;

: Desired format :
: if (condition1) then
: do something to quit/jump/goto/return
: maybe raise indent_related_exception and quit
: end if ;
: a block of 300 lines; -- here one tab for indentation is saved
: compared to above code...

: Please advise. TIA.

Personally I don't mind code such as

        START

		if easily detectable error1 raise error 1
		if easily detectable error2 raise error 2

		if parameters are null return NULL
		if trivial case return trivial answer

		-- now "real" processing begins

		if something
		then
			code now indented correctly
		else
			and only returns at end
			like explained in the 
			instruction manual
		end
		return complicated answer

	END

You'll see this implicitly in many examples of loops

	loop
	fetch
		if end of data then exit loop
		-- ELSE is implicit
		code not indented
	end loop


If you like the style then use it.

--

This space not for rent.
Received on Sat May 21 2005 - 16:04:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US