Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Trigger for limiting the row count of a table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Fri Nov 13, 2009 6:32 pm    Post subject: Trigger for limiting the row count of a table
Reply with quote

Hi ,

Is it possible we can limit the row count of a table using trigger. Suppose I have a table in which I do not want more than 100 records . When 101 is tried to be inserted to that table it should throw a signal Record Overflow . Is it possible??
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Nov 13, 2009 7:01 pm    Post subject:
Reply with quote

As a very simple answer to a very broad question - yes.

The INSERT Trigger would be activated after each insert,
the trigger would be a simple COUNT(*)
and when COUNT(*) > 100
then signal.

The signal (which would be a negative sql code) would inhibit the insertion of the 101st ROW.

by the way, every DB2 Vsn? SQL Reference & the DB2 Vsn? Application Programming and SQL Guide
has chapters devoted to Triggers.

If you start using proper terminology, you searches will be more successful.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us