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

Auto insert in the DB2 table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mlp

New User


Joined: 23 Sep 2005
Posts: 91

PostPosted: Tue Feb 16, 2010 4:41 pm
Reply with quote

I have requirement in which I need to fill in data to one DB2 table automaticaly as and when another DB2 table has one row inserted.

Can I put some kind of rule or constraint in the create table query so that this requirement can be realised?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 16, 2010 5:04 pm
Reply with quote

search and read the db2 docs about TRIGGERS
from somewhere in the manuals
Quote:
"a set of actions that are activated or triggered by an update operation on a specified base table."
Back to top
View user's profile Send private message
mlp

New User


Joined: 23 Sep 2005
Posts: 91

PostPosted: Tue Feb 16, 2010 5:15 pm
Reply with quote

I dont want implement it via stored proc or triggers. I think it is possible in CREATE TABLE query itslef. Please correct me if I am wrong.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 16, 2010 5:29 pm
Reply with quote

Quote:
I have requirement in which I need to fill in data to one DB2 table automaticaly as and when another DB2 table has one row inserted.
Quote:
I dont want implement it via stored proc or triggers.


... typical forgotten requirement , to be satisfied without changing anything
and refusing to use the obvious solution TRIGGERS
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Feb 16, 2010 5:50 pm
Reply with quote

If you are handling updates from application programs only, you will have to identify all access modules with insert capability and modify these modules to update the other table as well.

If users update by creating their own SQL, the only way is user information and/or frequent use of an integrity check application.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 16, 2010 10:03 pm
Reply with quote

Hello,

Quote:
I dont want implement it via stored proc or triggers
Suggest that what you want not be the driving force with this. . .

How might you justify not using a feature that was implemented in the database software for exactly what you need to accomplish. . .?

What business reason would prevent this? Sorry, but a developer's want is not a business reason.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Feb 16, 2010 10:16 pm
Reply with quote

Adding a TRIGGER to the table or changing the application code would require that someone admit the design was flawed. Maybe someone could find a ways to pass this off as a user required design change.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Feb 17, 2010 3:39 pm
Reply with quote

Quote:
How might you justify not using a feature that was implemented in the database software for exactly what you need to accomplish. . .?

The internal IT policies and standards may specify that DB2 triggers/stored procedures are not to be used in applications, to limit the number of ways update transactions enters the system, or to simplify the architecture.
Such policy decisions have a way of prevailing if no one challenges them at a later maturity state of the techniques.
Back to top
View user's profile Send private message
mlp

New User


Joined: 23 Sep 2005
Posts: 91

PostPosted: Wed Feb 17, 2010 4:53 pm
Reply with quote

I was trying find out a way with which I can avoid strored procs or triggers. But I guess its not possible with DB2.

I have to settle down with triggers only.

Thanks all for your help..!!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Feb 17, 2010 4:57 pm
Reply with quote

Quote:
But I guess its not possible with DB2.

nor with any other dbms, oracle, postgresql, informix
that I know and worked with
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 Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top