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
 

 

SQLCODE=-122

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

New User


Joined: 31 Jul 2007
Posts: 1
Location: New Delhi

PostPosted: Wed Oct 13, 2010 7:55 pm    Post subject: SQLCODE=-122
Reply with quote

Hi!

The following query is returning SQLCODE=-122. Do I need to add all the columns that I am SELECTing in the GROUP BY clause?

SELECT C20.PRSN_INTN_ID
,SUM(C20.SMRY_BAL_UT)
,C20.SMRY_THRU_PRCS_DT
,VALUE (AAA.UTAFTER,0)
,A31.PLAN_ID
,A31.ACCT_ID
,A31.FUND_ID
,A31.SF_ID
,A22.EM_CLNT_ID
,VALUE (A26.ORG_CD,' ')
,VALUE (A04.EMPL_STAT_CD,' ')
,VALUE (A56.PLAN_STAT_CD,' ')
FROM PRSN_SMRY_HBAL C20

LEFT JOIN
(SELECT PRSN_INTN_ID
,HBAL_ID
,SUM(BAL_UT) AS UTAFTER
FROM PRSN_HBAL A52A
WHERE PRCS_DT > :Host-EfEndDt
GROUP BY PRSN_INTN_ID
,HBAL_ID
) AAA
ON AAA.PRSN_INTN_ID = C20.PRSN_INTN_ID
AND AAA.HBAL_ID = C20.HBAL_ID

INNER JOIN
HBAL A31
ON A31.HBAL_ID = C20.HBAL_ID

INNER JOIN
PRSN A22
ON A22.PRSN_INTN_ID = C20.PRSN_INTN_ID

LEFT JOIN
EE_ORG A26
ON A26.PRSN_INTN_ID = C20.PRSN_INTN_ID
AND A26.ORG_CAT_ID = :A26-ORG-CAT-ID
AND EE_ORG_EFBEGDT <= :Host-EfEndDt
AND EE_ORG_EFENDDT >= :Host-EfEndDt

LEFT JOIN
EE_EMPL_CAT A04
ON A04.PRSN_INTN_ID = C20.PRSN_INTN_ID
AND A04.EMPL_CAT_ID = :A04-EMPL-CAT-ID
AND EE_EMPLCAT_EFBEGDT <= :Host-EfEndDt
AND EE_EMPLCAT_EFENDDT >= :Host-EfEndDt

LEFT JOIN
PP_STAT A56
ON A56.PRSN_INTN_ID = C20.PRSN_INTN_ID
AND A56.PLAN_STAT_CAT_ID = :A56-PLAN-STAT-CAT-ID
AND EE_EMPLCAT_EFBEGDT <= :Host-EfEndDt
AND EE_EMPLCAT_EFENDDT >= :Host-EfEndDt

GROUP BY AAA.HBAL_ID
,C20.PRSN_INTN_ID
,C20.SMRY_BAL_UT

ORDER BY A31.PLAN_ID

WITH UR
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 Oct 13, 2010 8:38 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

At the top of the page is a link to "IBM Manuals". Down the list are some DB2 Messages and Codes documentation. These contain explanations for SQL return codes.

For the -122 read here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnmcj10/2.1.6.28

If you find something in the manual that is not clear, post what you found and your doubt. Someone will be able to clarify.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Fri Oct 15, 2010 1:45 pm    Post subject:
Reply with quote

yes, unless you use the same trick as you did for subselect AAA

Code:
...
FROM (select PRSN_INTN_ID,SMRY_THRU_PRCS_DT
           , sum(C20.SMRY_BAL_UT) as UTbefore  from PRSN_SMRY_HBAL
      group by  PRSN_INTN_ID,SMRY_THRU_PRCS_DT) C20

LEFT JOIN ...
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 SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm
No new posts Need to understand SQLCODE = 12 rohanthengal DB2 3 Thu Nov 05, 2015 11:22 am
No new posts SQLCODE -922 in Batch-Cics program tr... kishpra CICS 2 Thu Sep 10, 2015 12:36 pm
No new posts SQLCODE -450 for stored procedure spoorni DB2 3 Fri Jan 16, 2015 2:45 am
No new posts -81 SQLCODE returned when Remote Stor... kameswaramanoj.Akella DB2 1 Wed Dec 03, 2014 5:36 am


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