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
 
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: 6968
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 sending email from jcl using the mail... niloyarp JCL & VSAM 5 Tue Oct 10, 2017 12:32 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm

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