Problem with extract funtion
Posted in 2000
Topics: Stored Procedures & SPL
Hi all
I am having problems with the extract funtion on the Informix Dynamic
Server version 9.2.
In the following code I always get a syntax error on "from" in the
extract expression. "extract(week from a_date);"
Has the syntax changed since the release of Answers Online or am I
daft...
All comments appreciated...
Ragnar
BTW. The rest of the unfinished procedure:
CREATE PROCEDURE makeYear
(Y INT DEFAULT 0)
RETURNING INT;DEFINE a_date DATE;
DEFINE M INT DEFAULT 1;
DEFINE D INT DEFAULT 1;
DEFINE W INT DEFAULT 1;
LET a_date = MDY(01,01,Y);
WHILE (D < 367)
BEGIN
LET a_date = DATEADD(DAYOFYEAR, 1, a_date);
LET W = extract(week from a_date);
INSERT INTO WEEK(ID_WEEK, ID_YEAR, ID_DAY, DATE) VALUES (W, Y, D,a_date);
D = D+1;
END WHILE
END PROCEDURE;
--
Ragnar Agustsson
Iceland
ragnar_agustssonNOSPAM@hotmail.com
Sent via Deja.com http://www.deja.com/
Before you buy.