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
 

 

Query related to inserting an auto populated value in db2

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

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Fri Dec 18, 2015 12:09 am    Post subject: Query related to inserting an auto populated value in db2
Reply with quote

Hi,
I want to insert values in child table.I have seq-num field which is auto populated.so I hav not used the field itself in insert querry.
While promoting in changeman I get SQL code -407 .
Seq num is defined as smallint not null.
SQL 407 means trying to insert null value in a field declared as not null.I havnt used the field itself in insert.Any idea how to solve it??
I tried inserting the field also.I got SQL -206. Object used in a place which is not valid.I.hav no clue..Pls help
Thanks in advance
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Fri Dec 18, 2015 12:14 am    Post subject: Reply to: Query related to inserting an auto populated value in db2
Reply with quote

Why do you think it is the Seq-num which is giving trouble?

Are you sure you are not missing any column in the insert query ?

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Dec 18, 2015 5:43 am    Post subject:
Reply with quote

Quote:
I want to insert values in child table.I have seq-num field which is auto populated

What do you mean my that? Did you not use next seq num prior or during the insert?
look here

Quote:
Are you sure you are not missing any column in the insert query ?

It is not necessary to place all the columns if they have defined with defaults.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Fri Dec 18, 2015 9:03 am    Post subject:
Reply with quote

Hi,

If the Seq-num is defined as smallint Not null, how its getting auto populated?

Also how you come to conclusion seq-num is the culprit for -407?

its better if you share the table structure and code snippet

Regards,
Chandan
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Sat Dec 19, 2015 5:58 pm    Post subject:
Reply with quote

What has changeman got to do with this? When promoting, object are moved not executed. Are you saying that before promotion the objects worked in the environment but failed after in the same environment or failed in a different environment. If the latter then there is a discrepancy between environments. If you did not test before promotion then go shoot yourself.
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
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
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts SQL Query optimization. arunsoods DB2 12 Sun Sep 04, 2016 6:27 am
No new posts Query on BLSR Nileshkul JCL & VSAM 2 Sat Aug 13, 2016 5:18 am


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