RE: design question - stored procedures - best practice

  • From: <Paula_Stankus@xxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 27 Aug 2004 16:39:40 -0400

Guys,

I have a stored procedure that loads data and writes to an error log a =
specific field/message when there are issues.

I know that a better design would be to modularize this code as I have =
repetition/redundancy - yuck.

I don't return anything when I write to the log so I am thinking I =
should have the parent procedure do the integrity check then a child =
procedure (versus a function) write to the log.

Help - can someone provide advice on this????

here is a snippet.  I check values in a field then write to a log table:

/***Test 1***/
        IF=20
         @AC_VENT_IMMED =3D 'T' AND
         (@AC_VENT_30MIN =3D 'T' OR
         @AC_VENT_MORE_6HR =3D 'T')
        BEGIN
        insert into acclaris_log
        (state_file_number,field_name,
        reason,create_date)
        values
        (@STATE_FILE_NUMBER,'AC VENT','UNIQUE',getdate())
        print 'FAILED TEST ON AC CHECK'
        END

/***Test 2***/
        IF=20
         @AC_VENT_30MIN =3D 'T' AND
         (@AC_VENT_IMMED =3D 'T' OR
         @AC_VENT_MORE_6HR =3D 'T')
        BEGIN
        insert into acclaris_log
        (state_file_number,field_name,
        reason,create_date)
        values
        (@STATE_FILE_NUMBER,'AC VENT','UNIQUE',getdate())
        print 'FAILED TEST ON AC CHECK'
        END

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: