Ok, my syntax is off somewhere. Can someone set me straight on how to declare a local variable in a function?
The error I get is the following...
ERROR: syntax error at or near "declare"
Code:
CREATE OR REPLACE FUNCTION BLAH( bigint ) declare int cnt RETURNS void as $$ cnt = select count(*) from "DCx" where "Index" = $1; if cnt > 0 then -- do something end if $$ LANGUAGE sql;
ERROR: syntax error at or near "declare"
Comment