IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Trigger for limiting the row count of a table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Fri Nov 13, 2009 7:01 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top