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

Home -> Community -> Mailing Lists -> Oracle-L -> Re:PL/SQL coding style

Re:PL/SQL coding style

From: <dgoulet_at_vicr.com>
Date: Thu, 18 Jan 2001 12:40:31 -0500
Message-Id: <10745.127027@fatcity.com>


Chandini

    Let me see, did this sub-human once work for a government contractor? I once ran into a C programmer who worked for a nameless Washington beltway bandit that believed in coding 80 characters across the screen & using astronomical names fro variables. Sure the compiler could figure out what he was doing, but no one else could.

    GOTO and GOSUB are the bane of the programming world. They should be used VERY sparingly and only when no other way will do. In the beginning of my Pro*C days we almost always used the "EXEC SQL WHENEVER SQLERROR GOTO " clause. Later we found that checking for something other than 0 in sqlca.sqlcode was much more bullet proof, easier to read, and simplier to code. GOTO is one of those subroutine calls that never returns thereby making debugging or tracing a real pain in the &*#.

    As for "select ... into" that works fine as long as your absolutely positive that there will be one and only one returned record. The first time you have two or more records returned you'll see what I mean. Also a 'for ref in (select ...) loop end loop;" is so much easier to read that I can't imagine anyone doing otherwise. It's English, what more do you want. I really do not appreciate those who declare their cursors, then open, fetch, and close them. It's computereze, not English. Why would one want to use an object oriented language the old way?

    By all means, buck this twerp. Actually recommend that he take a class or two in object oriented programming. Might bring him out of the dark ages into the 21st century.

Dick Goulet

____________________Reply Separator____________________
Subject: PL/SQL coding style
Author: "Chandini Paterson" <chandini.paterson_at_morse.com> Date: 1/18/2001 8:01 AM

Hi gurus,
  I've just changed jobs quite recently and am already having problems with my Senior Developer (yippee)
  It concerns the PL/SQL coding style. The guy insists that I use 'SELECT ..INTO ' in my code rather than explicit cursors, even though I tried telling him it is more efficient with the latter. He apparently finds it more 'readable' with the 'SELECT.. INTO ' and says that the double fetch
(for each row) is 'no big deal'.

  Also, he insists of using a lot of GOTOs in his code and expects me to do the same. I am adamant that we use EXCEPTION handlers to achieve the same thing (BAsically he checks for error conditions in his code and then does a 'goto error_handler' to handle the error!!!). I prefer using EXCEPTIONS to handle all my error conditions.
  I was just wondering if my concepts are all wrong at this time. I am just curious to know if any of you find his way of coding style preferable to mine. (OH, by the way, he was initially a 'C' progrmmer). Any inputs will be greatly appreciated.

Thanks
Chandini

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Chandini Paterson
  INET: chandini.paterson_at_morse.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Thu Jan 18 2001 - 11:40:31 CST

Original text of this message

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