473,396 Members | 1,982 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,396 software developers and data experts.

Select Sub Query in Select Clause giving error

Hi
I have some business requirement for which i need to format some query which will be something like this

SELECT B.D_INCDNT
,B.L_INCDNT_TYP
,( SELECT A.I_PO FROM P.PQDCLSA A
WHERE A.I_INCDNT = B.I_INCDNT ) I_PO
FROM P.PQDCLSM B
WHERE B.I_INCDNT = '0700100';

When I run this sample query it gives me following error

DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "A". SOME SYMBOLS THAT MIGHT BE
LEGAL ARE: + ) -
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 0 0 0 -1 234 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF'
X'000000EA' X'00000000' SQL DIAGNOSTIC INFORMATION

I am using DB2 on mainframe.

Any help on this will be great.

Thanks in Advance.
Apr 25 '07 #1
3 7441
frozenmist
179 Expert 100+
Hi
I have some business requirement for which i need to format some query which will be something like this

SELECT B.D_INCDNT
,B.L_INCDNT_TYP
,( SELECT A.I_PO FROM P.PQDCLSA A
WHERE A.I_INCDNT = B.I_INCDNT ) I_PO
FROM P.PQDCLSM B
WHERE B.I_INCDNT = '0700100';

When I run this sample query it gives me following error

DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "A". SOME SYMBOLS THAT MIGHT BE
LEGAL ARE: + ) -
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 0 0 0 -1 234 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF'
X'000000EA' X'00000000' SQL DIAGNOSTIC INFORMATION

I am using DB2 on mainframe.

Any help on this will be great.

Thanks in Advance.

You may not be able to use the correlated query in the select...try using a join...
May 2 '07 #2
chandu031
78 Expert
Hi
I have some business requirement for which i need to format some query which will be something like this

SELECT B.D_INCDNT
,B.L_INCDNT_TYP
,( SELECT A.I_PO FROM P.PQDCLSA A
WHERE A.I_INCDNT = B.I_INCDNT ) I_PO
FROM P.PQDCLSM B
WHERE B.I_INCDNT = '0700100';

When I run this sample query it gives me following error

DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "A". SOME SYMBOLS THAT MIGHT BE
LEGAL ARE: + ) -
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 0 0 0 -1 234 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF'
X'000000EA' X'00000000' SQL DIAGNOSTIC INFORMATION

I am using DB2 on mainframe.

Any help on this will be great.

Thanks in Advance.
Hi,

On the contrary you can use corelated subselect within a Select statement.
I assume P here is your schema name?
May 2 '07 #3
frozenmist
179 Expert 100+
Thanx Chandu... Ya I tried out the query too... It works...i dont see any error...
I ran the same query ... it didnt give any syntax errors as you had specified. If you still have the problem please do reply. I will also try...
Cheers
May 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: atse | last post by:
Hi, My table in the database may contain duplicate records, which means except the primary key (auto_increment) field is unique, all or almost of all the fields are with the same content. How...
5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
26
by: GreatAlterEgo | last post by:
Hi, This is my query which is embedded in a COBOL program. EXEC SQL SELECT DATE, AGE, DURATION, AMT INTO :LDATE, :L.AGE, :L.DURATION, :L.AMT FROM TAB1 WHERE CODE = :KEY.CODE AND...
6
by: Bob Stearns | last post by:
I am getting unwanted duplicate rows in my result set, so I added the DISTINCT keyword to my outermost SELECT. My working query then returned the following message: DB2 SQL error: SQLCODE: -214,...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.