SQL*Forms Trigger Optimization

SQL*Forms Trigger Optimization

Post by james.juris » Fri, 25 Dec 1992 07:01:19



Greetings, netters:

I'm using SQL*Forms 3.0 under Oracle v6, and my question is this:

Is is more efficient to code one form-level trigger or many block-level
triggers to accomplish a task.  For example, I have triggers with the
following structure:

        (Form level KEY-DOWN)
        declare
                valid boolean := TRUE;
        begin
                if :system.cursor_block = 'block1' then
                        procedure1(valid);
                elsif :system.cursor_block = 'block2' then
                        procedure2(valid);
                elsif :system.cursor_block = 'block3' then
                        procedure3(valid);
                else
                        valid := FALSE;
                end if;
                if (valid = TRUE) then
                        down;
                end if;
        end;

        (Block level KEY-DOWN (one for each of blocks 1, 2, and 3))
        declare
                valid boolean := TRUE;
        begin
                procedureX(valid);
                if (valid = TRUE) then
                        down;
                end if;
        end;

I believe that it's good practice to define each trigger as close as
possible to its point of use (in this case, at the block level), but
this can greatly increase the size of the INP file and thus, I assume,
the memory requirements since a larger program must be loaded at run
time.  From that perspective it would seem that the form-level approach
is more prudent.  

It comes down to this:  which is more efficient?  And, while we're at
it, which style do you prefer.

Please e-mail responses, I will post a summary.  Thanks in advance for
any assistance!

Jim


                  "Musical elation is my only consolation..."
           Views/opinions above:  Mine, not AT&T's nor probably yours
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 
 
 

SQL*Forms Trigger Optimization

Post by fgre.. » Tue, 29 Dec 1992 17:38:35



> Greetings, netters:

> I'm using SQL*Forms 3.0 under Oracle v6, and my question is this:

> Is is more efficient to code one form-level trigger or many block-level
> triggers to accomplish a task.  For example, I have triggers with the
> following structure:

>    (Form level KEY-DOWN)
>    declare
>            valid boolean := TRUE;
>    begin
>            if :system.cursor_block = 'block1' then
>                    procedure1(valid);
>            elsif :system.cursor_block = 'block2' then
>                    procedure2(valid);
>            elsif :system.cursor_block = 'block3' then
>                    procedure3(valid);
>            else
>                    valid := FALSE;
>            end if;
>            if (valid = TRUE) then
>                    down;
>            end if;
>    end;

>    (Block level KEY-DOWN (one for each of blocks 1, 2, and 3))
>    declare
>            valid boolean := TRUE;
>    begin
>            procedureX(valid);
>            if (valid = TRUE) then
>                    down;
>            end if;
>    end;

> I believe that it's good practice to define each trigger as close as
> possible to its point of use (in this case, at the block level), but
> this can greatly increase the size of the INP file and thus, I assume,
> the memory requirements since a larger program must be loaded at run
> time.  From that perspective it would seem that the form-level approach
> is more prudent.  

> It comes down to this:  which is more efficient?  And, while we're at
> it, which style do you prefer.

> Please e-mail responses, I will post a summary.  Thanks in advance for
> any assistance!

> Jim


>                   "Musical elation is my only consolation..."
>            Views/opinions above:  Mine, not AT&T's nor probably yours
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In your definition of 'efficiency' you need to consider both machine efficiency
and development efficiency.  If you replicate the required function within
multiple trigger steps, how do you correct any errors in logic (yes, I make
logic errors) or accommodate changes in design logic?  If the trigger logic
is replicated, you (or whoever follows you) has to remember or trace down
each of the multiple triggers affected.  Far better to consolidate these
steps into a single trigger (procedure, actually) at the form level with good
documentation as to its purpose.

I never thought of it in these terms before, but what you really need to do is
normalize your triggers just as you normalize your table design.

  ---------------------------------------------------------------------------
  |      Frank Greene                  |          //////  //////             |
  |      DELPHI SYSTEMS, Inc.          |           ////    ////              |
  |      Telephone [615] 458-6032      |          ////    ////  //////       |
  |      324 Ootsima Way               |         ////    ////    ////        |
  |      Loudon, TN 37774              |        //////  //////  //////       |
  ----------------------------------------------------------------------------
  |         Of course, any opinions or suggestions are strictly my own       |
  ----------------------------------------------------------------------------

 
 
 

1. Anyone Have SQL*Forms 3.0 Trigger Text They'd Like to Share?

It's me again!  Thanks to those of you who responded to my previous
posts about removing the "Count: X" line and using the ring menu.
I'll post a summary of responses next week after I've tried out the
ideas.

Now I'm entering trigger-land.  I've read the Designer's Reference,
worked through the Designer's Tutorial, and looked at the example
forms.  Unfortunately, there aren't a lot of _usable_ example triggers
in the manuals.  I don't really know PL/SQL and I think that's what
you're supposed to use to write trigger text if you need to do 'logical'
things (i.e. validate entered data against tables and other values).

Does anyone have any nice triggers they'd be willing to show me?  I
don't want you to give me anything proprietary or anything you might
get in trouble for.  I really just need to see examples of how to do
basic things with triggers and the syntax of the trigger text.

If I get any worthwhile stuff, I'll post a summary.

a T d H v A a N n K c S e

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scott D. Brenner
AT&T Consumer Communications Services
Basking Ridge, NJ

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. ANNOUNCE: IEEE ParaScope: Parallel Computing Links

3. SQL*Forms 3.0 Trigger Trouble

4. Apple Reps ignorance of the IIgs

5. SQL*FORM Trigger Question(

6. Anyone tried GoLive?

7. SQL*Forms PRE-QUERY trigger question...

8. tcp/ip 4.1 on cd?

9. SQL*Forms 3.0 and Triggers

10. SQL*Forms question - Key trigger for spawning report.

11. SQl*FORMS HOST trigger

12. SQL*Forms 2.3 PRE-INSERT and PRE-UPDATE Triggers

13. Sql*Forms Trigger question on Update ?