473,215 Members | 1,242 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,215 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 6843
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%" ==...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.