Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

WHERE Clause issue

Hi, I have run the following command successfully without the WHERE clause on the last line. However, when I try to use a parameter, it fails. Is there anything wrong with it?

CREATE TABLE #DateList

(

Dates DateTime NOT NULL PRIMARY KEY

);

DECLARE locDate DateTime;

DECLARE BEG DateTime;

DECLARE FIN DateTime;

DECLARE N DOUBLE PRECISION;

//-- Sets the 1st date in the table.

SET BEG=TIMESTAMP '2000-01-01 00:00:00';

//-- Sets the Last date in the Table.

SET FIN=TIMESTAMP '2008-12-31 00:00:00';

//-- Fills all the dates in between...

SET locDate = BEG;

WHILE locDate <= FIN DO

INSERT INTO #DateList

(Dates)

SELECT locDate AS Dates FROM #dummy;

/* This should work, but it looks like Nexus haven't written the code yet to

actually add dates, the slack dogs.

SET locDate=locDate + INTERVAL '1' DAY;

*/

SET N = CAST(locDate AS DOUBLE PRECISION) + 1;

SET locDate = CAST(N AS TIMESTAMP);

END WHILE;

SELECT *

FROM #DateList;

DROP TABLE #DateList;

SELECT "WeatherDetail"."RainFall", "WeatherStation"."Name", "WeatherDetail"."Date"

FROM "WeatherDetail" "WeatherDetail" INNER JOIN "WeatherStation" "WeatherStation" ON "WeatherDetail"."WeatherStationID"="WeatherStation"."WeatherStationID"

WHERE "WeatherStation"."Name" = {?Station}

Former Member
Not what you were looking for? View more on this topic or Ask a question