WebSphere Commerce suite - SQL Exception Problem

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Commerce suite > August 2004 > SQL Exception Problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author SQL Exception Problem
Gil Lopez

2004-08-27, 6:29 pm

Hello. I have a session bean that extends the BaseJDBCHelper. I have the
following SQL string (where PTXSTOREAVAIL is a custom table):

private static final String FIND_STORES_SCHEDULED_TO_CLOSE_SQL =

"SELECT T1.STORE_ID FROM PTXSTOREAVAIL T1, STORE T2 WHERE T1.ACTIVE = 1 "

+"AND T1.MARKFORDELETE = 0 AND T1.DAY_ID = (VALUES DAYNAME (CURRENT
TIMESTAMP)) "

+"AND T1.START_DATE <= (VALUES CURRENT TIMESTAMP) AND T1.END_DATE >= (VALUES
CURRENT TIMESTAMP) "

+"AND T1.CLOSE_TIME <= (VALUES CURRENT TIME) AND T1.OPEN_TIME >= (VALUES
CURRENT TIME) "

+"AND T1.STORE_ID = T2.STORE_ID AND T2.STATUS = 1";



However, when I try to run this statement, I get the following error:

SQL0104N An unexpected token ""TIME"" was found following "E <= (VALUES
CURRENT". Expected tokens may include: "<space>". SQLSTATE=42601

This query runs fine from the command line. I tried adding a semi colon to
the end of the string but that doesn't help. I am running DB2 8.1 with WCBE
5.5. Any help would really be appreciated.




Robert Brown

2004-08-27, 6:29 pm

Change TIME with TIMESTAMP

+"AND T1.CLOSE_TIME <= (VALUES CURRENT TIMESTAMP) AND T1.OPEN_TIME >=
(VALUES CURRENT TIMESTAMP) "

R

Gil Lopez wrote:
> Hello. I have a session bean that extends the BaseJDBCHelper. I have the
> following SQL string (where PTXSTOREAVAIL is a custom table):
>
> private static final String FIND_STORES_SCHEDULED_TO_CLOSE_SQL =
>
> "SELECT T1.STORE_ID FROM PTXSTOREAVAIL T1, STORE T2 WHERE T1.ACTIVE = 1 "
>
> +"AND T1.MARKFORDELETE = 0 AND T1.DAY_ID = (VALUES DAYNAME (CURRENT
> TIMESTAMP)) "
>
> +"AND T1.START_DATE <= (VALUES CURRENT TIMESTAMP) AND T1.END_DATE >= (VALUES
> CURRENT TIMESTAMP) "
>
> +"AND T1.CLOSE_TIME <= (VALUES CURRENT TIME) AND T1.OPEN_TIME >= (VALUES
> CURRENT TIME) "
>
> +"AND T1.STORE_ID = T2.STORE_ID AND T2.STATUS = 1";
>
>
>
> However, when I try to run this statement, I get the following error:
>
> SQL0104N An unexpected token ""TIME"" was found following "E <= (VALUES
> CURRENT". Expected tokens may include: "<space>". SQLSTATE=42601
>
> This query runs fine from the command line. I tried adding a semi colon to
> the end of the string but that doesn't help. I am running DB2 8.1 with WCBE
> 5.5. Any help would really be appreciated.
>
>
>
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com