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

Added columns not present in Insert Query!


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Tue Aug 21, 2007 1:15 am
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
Reply with quote

Thanks d! icon_smile.gif
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: Wed Aug 22, 2007 2:28 am
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top