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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm


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