[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Capturing counts on an UPDATE stmt...



I am in need of capturing update counts within an SQR report, but am not
sure quite how to do it.  For example if I issue the following statement:

     BEGIN-SQL
     UPDATE ssbsect
     SET    ssbsect_seats_avail =  (ssbsect_max_enrl - ssbsect_enrl)
     WHERE  ssbsect_term_code   =  $PARM_term
     AND    ssbsect_seats_avail <> (ssbsect_max_enrl - ssbsect_enrl)
     END-SQL

how can I capture the number of records it updated?  The only two ways
I can think of are:

   a) Add a pre-count using the same where clause.  The drawback
      with this is performance, especially where there are a lot
      of separate updates.

   b) Use the -S option at runtime to get row counts.  This option
      has the drawback of not being very readable from a user
      standpoint and is stored in a separate output file.

Are there any other alternatives I have overlooked?

Thanks,
Lydia


--------------------------------------------------------------------------
Lydia Verhoef
Programmer/Analyst                                        lverhoef@pcc.edu
Portland Community College                                  (503) 977-4750
Information Technology Services                     http://www.pcc.edu/its
--------------------------------------------------------------------------