Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Added columns not present in Insert Query!

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

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Tue Aug 21, 2007 1:05 am    Post subject: Added columns not present in Insert Query!
Reply with quote

Hi,

We have altered a Db2 table and added 5 more columns in the last.
There is an existing insert query which inserts into this table but does not have these new 5 columns.

This insert query is in CICS screen.

Will this insert query in CICS screen work fine without the new 5 columns ?

Thanks
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 Aug 21, 2007 1:15 am    Post subject:
Reply with quote

Hello,

Quote:
Will this insert query in CICS screen work fine without the new 5 columns ?

That will depend on the definition and usage of these new fields.

It may also happen that your current screen will insert rows without the new fields, but that other processes later may have problems.

It is a good idea for an insert to make sure all of the fields have an acceptable value.
Back to top
View user's profile Send private message
Hritam

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Wed Aug 22, 2007 2:26 am    Post subject:
Reply with quote

Thanks d! icon_smile.gif
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: Wed Aug 22, 2007 2:28 am    Post subject:
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Aug 22, 2007 2:37 am    Post subject:
Reply with quote

If the fields allow NULL values it will be fine, but all those extra 5 columns will contain NULL. If they are defined to not allow NULL your insert will fail.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 22, 2007 3:13 am    Post subject:
Reply with quote

Steve,

won't NOT NULL WITH DEFAULT take care of that problem? As long as the OP is ok with 5 columns with zeros or spaces in the 'unmentioned' columns.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Aug 22, 2007 5:43 am    Post subject:
Reply with quote

I stand corrected. I'm not a DBA, I only play with them and forgot about the default on columns even though I deal with it every day.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Aug 22, 2007 6:11 am    Post subject:
Reply with quote

When you add new columns to an existing table the new columns either have to be null or not null with default. An insert that worked before the columns were added will work afterwards.
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us