home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / oracle / 2638 < prev    next >
Encoding:
Internet Message Format  |  1992-12-28  |  3.5 KB

  1. Path: sparky!uunet!hayes!fgreene
  2. From: fgreene@hayes.com
  3. Newsgroups: comp.databases.oracle
  4. Subject: Re: SQL*Forms Trigger Optimization
  5. Message-ID: <6600.2b3ebd0b@hayes.com>
  6. Date: 28 Dec 92 08:38:35 EDT
  7. References: <1992Dec23.220119.11645@cbfsb.cb.att.com>
  8. Organization: Hayes Microcomputer Products, Norcross, GA
  9. Lines: 81
  10.  
  11. In article <1992Dec23.220119.11645@cbfsb.cb.att.com>, jurista@cbnewsg.cb.att.com (james.jurista) writes:
  12. > Greetings, netters:
  13. > I'm using SQL*Forms 3.0 under Oracle v6, and my question is this:
  14. > Is is more efficient to code one form-level trigger or many block-level
  15. > triggers to accomplish a task.  For example, I have triggers with the
  16. > following structure:
  17. >     (Form level KEY-DOWN)
  18. >     declare
  19. >         valid boolean := TRUE;
  20. >     begin
  21. >         if :system.cursor_block = 'block1' then
  22. >             procedure1(valid);
  23. >         elsif :system.cursor_block = 'block2' then
  24. >             procedure2(valid);
  25. >         elsif :system.cursor_block = 'block3' then
  26. >             procedure3(valid);
  27. >         else
  28. >             valid := FALSE;
  29. >         end if;
  30. >         if (valid = TRUE) then
  31. >             down;
  32. >         end if;
  33. >     end;
  34. >     (Block level KEY-DOWN (one for each of blocks 1, 2, and 3))
  35. >     declare
  36. >         valid boolean := TRUE;
  37. >     begin
  38. >         procedureX(valid);
  39. >         if (valid = TRUE) then
  40. >             down;
  41. >         end if;
  42. >     end;
  43. > I believe that it's good practice to define each trigger as close as
  44. > possible to its point of use (in this case, at the block level), but
  45. > this can greatly increase the size of the INP file and thus, I assume,
  46. > the memory requirements since a larger program must be loaded at run
  47. > time.  From that perspective it would seem that the form-level approach
  48. > is more prudent.  
  49. > It comes down to this:  which is more efficient?  And, while we're at
  50. > it, which style do you prefer.
  51. > Please e-mail responses, I will post a summary.  Thanks in advance for
  52. > any assistance!
  53. > Jim
  54. > -=-=-=-=-=- Jim Jurista =-=-=-= Internet: jurista@llssak.attmail.com =-=-=-=-
  55. >                   "Musical elation is my only consolation..."
  56. >            Views/opinions above:  Mine, not AT&T's nor probably yours
  57. > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.  
  59. In your definition of 'efficiency' you need to consider both machine efficiency
  60. and development efficiency.  If you replicate the required function within
  61. multiple trigger steps, how do you correct any errors in logic (yes, I make
  62. logic errors) or accommodate changes in design logic?  If the trigger logic
  63. is replicated, you (or whoever follows you) has to remember or trace down 
  64. each of the multiple triggers affected.  Far better to consolidate these
  65. steps into a single trigger (procedure, actually) at the form level with good
  66. documentation as to its purpose.
  67.  
  68. I never thought of it in these terms before, but what you really need to do is
  69. normalize your triggers just as you normalize your table design.
  70.  
  71.  
  72.   ---------------------------------------------------------------------------
  73.   |      Frank Greene                  |          //////  //////             |
  74.   |      DELPHI SYSTEMS, Inc.          |           ////    ////              |
  75.   |      Telephone [615] 458-6032      |          ////    ////  //////       |
  76.   |      324 Ootsima Way               |         ////    ////    ////        |
  77.   |      Loudon, TN 37774              |        //////  //////  //////       |
  78.   ----------------------------------------------------------------------------
  79.   |         Of course, any opinions or suggestions are strictly my own       |
  80.   ----------------------------------------------------------------------------
  81.  
  82.