Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

plpgsql parse error

Status
Not open for further replies.

HobbyMan

Programmer
Sep 22, 2000
25
0
0
US
This is my first attempt at a plpgsql function.

Here is what I have thus far:

create function fnInsWeeks() returns integer as '
DECLARE
--theDate wedates2.wedate%TYPE;
thedate DATE;
BEGIN
SELECT INTO thedate wedate FROM wedates2 WHERE id=(SELECT MAX(id) FROM wedates2);

INSERT INTO wedates2 (wedate) VALUES (thedate+7);

return 0;
END;
' language 'sql';



It comes back at my with this:

ERROR: parser: parse error at or near "date"

Can someone please tell me what is incorrect
in the above?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top