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
 
Auto insert in the DB2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Auto insert in the DB2 table
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Tue Feb 16, 2010 5:04 pm    Post subject: Reply to: Auto insert in the DB2 table
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    Post subject: Reply to: Auto insert in the DB2 table
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Tue Feb 16, 2010 5:29 pm    Post subject: Reply to: Auto insert in the DB2 table
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    Post subject:
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

Site Director


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

PostPosted: Tue Feb 16, 2010 10:03 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Auto insert in the DB2 table
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Wed Feb 17, 2010 4:57 pm    Post subject: Reply to: Auto insert in the DB2 table
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    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 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 Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm

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