cancel
Showing results for 
Search instead for 
Did you mean: 

WHERE Clause issue

Former Member
0 Kudos

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}

Accepted Solutions (0)

Answers (1)

Answers (1)

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Please remember to give all necessary information, such as the error message. This will help users identify the cause of your issue.

Former Member
0 Kudos

Thanks, found the problem, missing a single quote around the parameter.