Subject | sql question |
---|---|
Author | Peter Chaisty |
Post date | 2005-01-06T18:02:48Z |
Hi
I'm stuck on some sql that I am converting from a stored procedure and
I am getting an error
List index out of bounds (2)
The sql is
INSERT INTO PIN_REPORT(VOUCHER_ID,PRODUCT_ID)
SELECT DISTINCT VOUCHER_ID,PRODUCT_ID
FROM PINS
WHERE
(PINS.DOWNLOAD_DATE >= :startdate and PINS.DOWNLOAD_DATE <
:enddate + 1)
OR
(PINS.STATUS_CHANGED >= :startdate and PINS.STATUS_CHANGED <
:enddate +1 AND PINS.STATUS = 5)
If I remove the OR statement and put in just one of the statements
either side of the or it works, so it's not a variable or expresion
problem.
Also the where expression works fine in a stored procedure.
I have tried extra brackets around the whole expression after the
WHERE statement but it then gives the List index error.
Can anyone suggest anything ?.
Peter
I'm stuck on some sql that I am converting from a stored procedure and
I am getting an error
List index out of bounds (2)
The sql is
INSERT INTO PIN_REPORT(VOUCHER_ID,PRODUCT_ID)
SELECT DISTINCT VOUCHER_ID,PRODUCT_ID
FROM PINS
WHERE
(PINS.DOWNLOAD_DATE >= :startdate and PINS.DOWNLOAD_DATE <
:enddate + 1)
OR
(PINS.STATUS_CHANGED >= :startdate and PINS.STATUS_CHANGED <
:enddate +1 AND PINS.STATUS = 5)
If I remove the OR statement and put in just one of the statements
either side of the or it works, so it's not a variable or expresion
problem.
Also the where expression works fine in a stored procedure.
I have tried extra brackets around the whole expression after the
WHERE statement but it then gives the List index error.
Can anyone suggest anything ?.
Peter