473,805 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL - Unexpected Token "date/interval"

Hello All,

While doing some TPC benchmark testing on DB2-UDB 8.2, I face the
following problem when running this query:

select *
from lineitem
where
l_shipdate <= date '1998-12-01' - interval '69' day (3)
SQL0104N An unexpected token "'1998-12-01'" was found following "e
l_shipdate
<= date". Expected tokens may include: "<space>". SQLSTATE=42601
I tried to remove the "date" and I got the following error:
SQL0104N An unexpected token "'69' day" was found following "98-12-01'
-
interval". Expected tokens may include: "<space>". SQLSTATE=42601

I have setup the TPC Query Generator to generate "DB2 Queries". Yet, I
face the above problem.

Any help would be appreciated.

Thank you.

Best Regards,
Salem

Nov 12 '05 #1
3 6973
UnixSlaxer wrote:
Hello All,

While doing some TPC benchmark testing on DB2-UDB 8.2, I face the
following problem when running this query:

select *
from lineitem
where
l_shipdate <= date '1998-12-01' - interval '69' day (3)
SQL0104N An unexpected token "'1998-12-01'" was found following "e
l_shipdate
<= date". Expected tokens may include: "<space>". SQLSTATE=42601
I tried to remove the "date" and I got the following error:
SQL0104N An unexpected token "'69' day" was found following "98-12-01'
-
interval". Expected tokens may include: "<space>". SQLSTATE=42601

I have setup the TPC Query Generator to generate "DB2 Queries". Yet, I
face the above problem.

l_shipdate <= date('1998-12-01') - 69 days

Someone must have done some really creative thinking with the generated
query ;-)

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
"Serge Rielau" <sr*****@ca.ibm .com> wrote in message
news:3g******** ****@individual .net...
l_shipdate <= date('1998-12-01') - 69 days

Someone must have done some really creative thinking with the generated
query ;-)
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab


If anyone wants to see the all actual queries that IBM used for the TPC-H
benchmark they are documented teh following link (posted on the TPC
website):
http://www.tpc.org/results/FDR/tpch/...030810.fdr.pdf

The query in question appears to be Query 1 of the TPC-H benchmark which is
documented on page 92 of the above referenced document.

Here is the entire query #1:

select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedp rice) as sum_base_price,
sum(l_extendedp rice * (1 - l_discount)) as
sum_disc_price,
sum(l_extendedp rice * (1 - l_discount) * (1 + l_tax))
as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedp rice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
tpcd.lineitem
where
l_shipdate <= date ('1998-12-01') - 90 day
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus

On page 17 of the above linked document, the query modifications made by IBM
are disclosed in accordance with Clause 2.2.3 of the TPC-H benchmark rules.

Appendix C.1, "Qualificat ion Queries," contains the output for each of the
queries. The functional query definitions and variants used in this
disclosure use the following minor query modifications:

- Table names and view names are fully qualified. For example, the nation
table is referred to as "TPCD.NATIO N."

- The standard IBM SQL date syntax is used for date arithmetic. For example,
DATE('1996-01-01') +3 MONTHS.

- The semicolon (;) is used as a command delimiter.
Nov 12 '05 #3
Thank you all for your responses.

Best Regards,
Salem

Nov 12 '05 #4

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

Similar topics

0
3299
by: charlesb | last post by:
I have a query that works in the rest of the SQL world "SELECT invoice.*, invoice.Date FROM invoice WHERE (DateDiff("m", Date, Now())=1);" which will give me all of last month's invoices. However it doesn't work with MySQL 4.0.
2
23361
by: ITM | last post by:
Does anyone have an example of an SQL query which returns rows for the year-to-date, but where the "year" commences on August 1st? e.g. select * from mytable where datefield > last august 1st TIA for any help Isabel
13
25338
by: John A Grandy | last post by:
apparently references of type Date can not assume the value Nothing, because the following code fails: Dim d As Date .......other code...... If d Is Nothing Then End If so then what is the equivalent to Nothing for a reference of type Date ?
2
4555
by: devprog | last post by:
objConn = New ADODB.Connection objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath _ & ";Jet OLEDB:Database Password=" & dbPassword) This cause error: (VB.NET. ) sqlString = "insert into table1 " _ & "(Date1,Time,Ext,Co) values " _ & "('04/04/05','06:02PM','101','01');"
12
13925
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL does not support it. Could someone helps me please? The example table: T1 (col1 varchar(7) not null,
17
5288
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
5
2173
by: veaux | last post by:
I'm thinking this is easy but can't get it. I have a table with following: Table1 Date 1/1/2007 Table2 Type 0107 (This is MMYY of above) So I'm having trouble using a query to turn the date from Table 1 into
0
2155
by: Curious | last post by:
Hi, I have two columns defined as DateTime type in the Visual Designer, i.e., Dataset.xsd. In the grid to which the columns are bound, they're both displayed as date, for instance, 5/23/2007. It seems that they're using the default "short date" format. I want to use the "long date" format to display the actual hour/minute/
4
2056
viktorijakup
by: viktorijakup | last post by:
Hi !!! @rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
0
9716
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, 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...
0
9596
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,...
0
10604
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, 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...
0
10356
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 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...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9179
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4316
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
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
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...

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.