473,396 Members | 2,002 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.

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 6901
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_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as
sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax))
as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) 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, "Qualification 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.NATION."

- 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
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. ...
2
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 ...
13
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...
2
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...
12
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...
17
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
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...
0
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....
4
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%" ==...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.