We assume that there exists a table terms(id,year,sess). sess is the semester S1 or S2.
create function Q3(id1 IN integer) returns TextString
declare tm TextString
begin
SELECT 'year%100'||lower(sess) into tm
FROM Terms
WHERE id1 = id
return tm
END;
I got an error near declare, what's wrong with my code?