473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Failed SQL statedment w/DB2

Osc
Hello all,

I am doing a search my test database and I am getting an error with
the sql search statement. I get the error message of : The statement
failed. Column ZCLOTNBR or expression in SELECT list not valid.
(SQLSTATE 42803, SQLCODE -122). Here is the SQL statement. I have
validated that all the fields exists.

SELECT L.ZCLOTNBR, L.ZCYRDNBR, L.ZCYRDCTY, DIGITS(L.ZCLOTCEN) AS
dLotCen, DIGITS(L.ZCLOTYER) AS dLotYear,
L.ZCAUCCCC, L.ZCAUCYYY, L.ZCAUCMMM, L.ZCAUCDDD, L.ZCLOTMDL,
L.ZCGRPMDL, L.ZCODRRCV, L.ZCODBCLC, L.ZCSTLTYP,
L.ZCDMGTYP, L.ZCVINNBR, Z.ZZYRDNBR, Z.ZZREQZIP, Z.ZZSTDMIL,
Z.ZZSTDZON, L.ZCCOD2UD, L.ZCASGCCC, L.ZCASGYYY,
L.ZCASGMMM, L.ZCASGDDD, L.ZCLOTNBR, L.ZCVINDES, L.ZCLOTMAK,
L.ZCRCDUSR, COUNT(L.ZCVINDES)
FROM LOTFNDZC01 L
INNER JOIN ZIPZONZZ01 Z
ON Z.ZZYRDNBR = L.ZCYRDNBR
WHERE L.ZCLOTMAK = '$(pMake)'
AND L.ZCLOTMDL = '$(pModel)'
AND L.ZCLOTYER > 98
Nov 12 '05 #1
2 5066
Ian
Osc wrote:
Hello all,

I am doing a search my test database and I am getting an error with
the sql search statement. I get the error message of : The statement
failed. Column ZCLOTNBR or expression in SELECT list not valid.
(SQLSTATE 42803, SQLCODE -122). Here is the SQL statement. I have
validated that all the fields exists.

SELECT L.ZCLOTNBR, L.ZCYRDNBR, L.ZCYRDCTY, DIGITS(L.ZCLOTCEN) AS
dLotCen, DIGITS(L.ZCLOTYER) AS dLotYear,
L.ZCAUCCCC, L.ZCAUCYYY, L.ZCAUCMMM, L.ZCAUCDDD, L.ZCLOTMDL,
L.ZCGRPMDL, L.ZCODRRCV, L.ZCODBCLC, L.ZCSTLTYP,
L.ZCDMGTYP, L.ZCVINNBR, Z.ZZYRDNBR, Z.ZZREQZIP, Z.ZZSTDMIL,
Z.ZZSTDZON, L.ZCCOD2UD, L.ZCASGCCC, L.ZCASGYYY,
L.ZCASGMMM, L.ZCASGDDD, L.ZCLOTNBR, L.ZCVINDES, L.ZCLOTMAK,
L.ZCRCDUSR, COUNT(L.ZCVINDES)
FROM LOTFNDZC01 L
INNER JOIN ZIPZONZZ01 Z
ON Z.ZZYRDNBR = L.ZCYRDNBR
WHERE L.ZCLOTMAK = '$(pMake)'
AND L.ZCLOTMDL = '$(pModel)'
AND L.ZCLOTYER > 98

Your error message description is not accurate:

SQL0122N A SELECT statement with no GROUP BY clause contains a
column name and a column function in the SELECT clause
or a column name is contained in the SELECT clause but
not in the GROUP BY clause.

Explanation:

The SELECT statement has one of the following errors:

o A column name and a column function are contained in the
SELECT clause but there is no GROUP BY clause.

o A column name is contained in the SELECT clause but not in
the GROUP BY clause.

The column may be contained in a scalar function.

If the NODENUMBER or PARTITION functions are specified in the
SELECT clause, then all partitioning key columns of the
underlying table are considered to be in the SELECT clause.

The statement cannot be processed.

User Response:

Correct the statement by including the columns in the GROUP BY
clause that are in the SELECT clause or by removing the columns
from the SELECT clause.

sqlcode : -122

sqlstate : 42803
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Nov 12 '05 #2
COUNT(L.ZCVINDES) ?
How many rows do you expect back.
Read SQL122 carefully. It says exactly what happens.

Cheers
Serge
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mo | last post by:
The code I've pasted below is taken directly from Microsoft's site at http://support.microsoft.com/default.aspx?scid=kb;EN-US;308157 As far as I can tell the error is raised on this line: conn...
0
by: Jeff Reed | last post by:
I am experiencing the the problem outlined the below. Unfortunately, I am using WinXP and I not sure if I can apply the solution due to lack of security control Any feed back would be apreciated ...
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
9
by: Bijoy Naick | last post by:
I've implemented forms authentication and authorization on my application. In my Web.Config, my authorization section looks like this.. <authorization> <allow roles="admin" /> <deny users="*"...
13
by: Adam | last post by:
Trying to get an asp.net 2.0 app running and am receiving this error. I see a bunch of people with this error on the net, but no solution: Works fine on my local machine, deployed to a server it...
6
by: ruben | last post by:
Hi: I'm running a large database on PostgreSQL 7.1.3. 20 days ago the database failed with a threatening and not too descriptive error like: pg_exec() query failed: server closed the...
2
by: news | last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And Apache/mySQL/PHP all work great through a browser. No errors. But when I try to run a PHP script through the command line, which I...
2
by: Dennis | last post by:
I'm getting the following problem occasionally...the application will work perfectly well for a period of time and then this pops up. I have tried turning off the default proxy in the...
1
by: kencana | last post by:
Hi all, I was wondering why I always get "failed to open stream: HTTP request failed!" error in either loading a normal or xml file. i don't understand why i can't get the whole result. the result...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.