Hi folks,
In case the SQL statement is not written properly, we sometimes get strange
messages. The 2 following statements are simple inversion between order by
and group by clause. We get an "advice" about expected from or from_clause,
why ?
db2 select workdept, count(*) from employee order by 1 group by workdept
SQL0104N An unexpected token "select workdept, count(*) from employ" was
found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<from_clause>" . SQLSTATE=42601
db2 select workdept, count(*) from employee order by workdept group by
workdept
SQL0104N An unexpected token "select workdept, count(*) from employee orde"
was found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<from>". SQLSTATE=42601
Regards,
Jean-Marc 1 3305
Jean-Marc Blaise wrote: Hi folks,
In case the SQL statement is not written properly, we sometimes get strange messages. The 2 following statements are simple inversion between order by and group by clause. We get an "advice" about expected from or from_clause, why ?
db2 select workdept, count(*) from employee order by 1 group by workdept SQL0104N An unexpected token "select workdept, count(*) from employ" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<from_clause>" . SQLSTATE=42601
db2 select workdept, count(*) from employee order by workdept group by workdept SQL0104N An unexpected token "select workdept, count(*) from employee orde" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<from>". SQLSTATE=42601
The GROUP BY clause has to come before the ORDER BY.
So the -104 (syntaxerror) is expected (the tokens are not terribly
useful I admit)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
DB2 UDB for Linux, Unix, Windows
IBM Toronto Lab This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Max Skaller |
last post by:
please reply to skaller@ozemail.com.au
(I don't read this newsgroup, and the reply-to address is fake)
For some time now -- over 5 years -- I have been using the
interscript literate programming and document generation tool
http://interscript.sourceforge.net
for all my programming tasks, both commercial and personal.
|
by: Phil |
last post by:
Hei,
I'm currently trying to write a program in C# that will allow users to
parametrize their queries.
For instance, I have a query like this:
SELECT * FROM Customers Where Region = @Region AND Gender > @Gender
How can I extract the Parameters names without using String
manipulation (which is not perfect since sql statements can also
contain '@' in LIKE clauses for example)
|
by: BerkshireGuy |
last post by:
Does anyone know of a good function that will parse out parts of an SQL
statement that is passed to it in seperate variables?
It should be able to parse statements that contain ORDERBY, WHERE,
GROUP, etc.
Thank you,
Brian
|
by: robert kurz |
last post by:
hallo ng,
i am trying to parse a sql-statement with regular expressions.
my goal is to get the parts of the statement. in my thoughts the
group-functionality of the regular expressions should do this.
my pattern looks like:
A) string strPattern = "(select.+)(from.+)(where.+)?(order.+)?";
|
by: SR |
last post by:
Hello:
I have some question on DB2 SQL Statement Cache. In the Oracle world,
we allways use bind variables extensively, otherwise, Oracle does not
re-use the statement cache, and there by resulting in excessive parsing
of the SQL Statements.
In DB2, I have a situation where I have statements with different cast
lengths:
| |
by: Peter Michaux |
last post by:
Hi,
I am reading the ECMAScript specs trying to figure out if the next
line is a legal statement or not
new Foo();
I think the above code may only be legal as an expression and not as a
stand alone statement. Would this make the above a bug?
|
by: Kbalz |
last post by:
Trying to run a simple query on my dataset
the SQL statement looks like this: select * from person
where id in (@p)
When using more than one id in the "in statement", I get nothing!
Using Visual Studio interface, there is the Execute Query button in
Query Builder. Here I can set @p = 1, and the test execute returns
the row where id = 1.. and I can do the same for @p = 2.
|
by: florian.loitsch |
last post by:
According to the spec Section 14 the production
SourceElements:SourceElements SourceElement is evaluated as follows:
1. Evaluate SourceElements.
2. If Result(1) is an abrupt completion, return Result(1)
3. Evaluate SourceElement.
4. Return Result(3).
If I understood correctly the following program should alert
'undefined':
alert(eval('3;;'));
|
by: Joshepmichel |
last post by:
Please to help me to following problem
I want to do this
1. create Table Name MEMBER on the Database Name "mytestdb",
2. Add the Values to the Table through the Key board Inputs during running the My Java Application.; Therefore I used this following codes, It Consists the seperate parts for the Raede and Member Class for the purposely I craetes.
3. I have problem to Parsing the values to SQL statement, that Consists on the Run Time...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |