MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

update failed

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Mon Nov 19, 2007 3:14 pm    Post subject: update failed Reply with quote

I have two tables as given below. I am trying to update the tab2 from Tab1 with below query:
UPDATE TAB2 B
SET B.IND = (
SELECT A.IND FROM TAB1 A
WHERE A.SNUM = B.SNUM
)

Code:
error:
SQLCODE = -4700, ERROR:  ATTEMPT TO USE NEW FUNCTION BEFORE NEW
FUNCTION MODE                                                 
SQLSTATE   = 56038 SQLSTATE RETURN CODE                       
SQLERRP    = DSNHSM1 SQL PROCEDURE DETECTING ERROR             
SQLERRD    = 507  0  0  -1  79  0 SQL DIAGNOSTIC INFORMATION   
SQLERRD    = X'000001FB'  X'00000000'  X'00000000'  X'FFFFFFFF'
X'0000004F'  X'00000000' SQL DIAGNOSTIC INFORMATION       




Tab1:
Code:
SNUM NAME IND
1   AAAA   Y
2   BBBB   Y
3   CCCC   Y
4   DDDD   N



tab2:
Code:
SNUM IND
1
2
3
4   

_________________
Thanks
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Mon Nov 19, 2007 3:36 pm    Post subject: Reply with quote

Try it without qualifying the columns listed in the SET clause:

Code:

UPDATE TAB2 B
SET IND = (
SELECT A.IND FROM TAB1 A
WHERE A.SNUM = B.SNUM
)
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Mon Nov 19, 2007 3:37 pm    Post subject: Re: update failed Reply with quote

Sarangadhar wrote:
I have two tables as given below. I am trying to update the tab2 from Tab1 with below query:
UPDATE TAB2 B
SET B.IND = (
SELECT A.IND FROM TAB1 A
WHERE A.SNUM = B.SNUM
)

Code:
error:
SQLCODE = -4700, ERROR:  ATTEMPT TO USE NEW FUNCTION BEFORE NEW
FUNCTION MODE                                                 
SQLSTATE   = 56038 SQLSTATE RETURN CODE                       
SQLERRP    = DSNHSM1 SQL PROCEDURE DETECTING ERROR             
SQLERRD    = 507  0  0  -1  79  0 SQL DIAGNOSTIC INFORMATION   
SQLERRD    = X'000001FB'  X'00000000'  X'00000000'  X'FFFFFFFF'
X'0000004F'  X'00000000' SQL DIAGNOSTIC INFORMATION       


Tab1:
Code:
SNUM NAME IND
1   AAAA   Y
2   BBBB   Y
3   CCCC   Y
4   DDDD   N



tab2:
Code:
SNUM IND
1
2
3
4   


Have you tried to lookup that error? I would suspect that it has something to due a recent update to your system.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Nov 19, 2007 4:38 pm    Post subject: Reply with quote

Sarangadhar,

I think your shop has upgraded to Version 8 of DB2 with new function mode off. Talk to your DBA

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Mon Nov 19, 2007 4:39 pm    Post subject: Reply with quote

jsharon1248
Thanks.. It's working if i dont qualify the updated column. Any reason why DB2 behaves such a way?
_________________
Thanks
Back to top
View user's profile Send private message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Mon Nov 19, 2007 4:55 pm    Post subject: Reply with quote

I did not see the messages from kolusu and craigG when I replied last time.. Maybe I did not refresh the page.

Any idea why it works after removing qualifier in the query as given by jsharon1248. How DB2 confused with qualifiers?
_________________
Thanks
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Nov 20, 2007 9:05 am    Post subject: Reply with quote

I'm not sure that DB2 for z/OS syntax ever allows the qualification for the SET columns. In any case, there's no need for it. You can only UPDATE 1 table, so qualifying the columns will not add any clarity to the statement.
Back to top
View user's profile Send private message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Tue Nov 20, 2007 1:12 pm    Post subject: Reply with quote

thanks for clarification, Mr. jsharon1248
_________________
Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group