I am trying to learn pspgsql but I am not having a lot of
luck. I have written a function but I keep getting the error
missing... at end of sql _expression_. Can anyone help! CREATE FUNCTION exp101 () RETURNS text AS
' DECLARE -- Declare a
variable to hold book titles and set its default -- value to a new
line. text_output
TEXT :=''\n''; -- Declare a
variable to hold rows from the -- books table. --row_data
enrollment%ROWTYPE; --row_dataa
student%ROWTYPE; BEGIN -- Iterate
through the results of a query. FOR row_data IN
select * from enrollment,
student where
enrollment.stdid = cast(student.stdid as char(4)) FOR row_dataa
IN select student.stdid , student.lname ,
student.fname ,student.mi, student.phone , student.major, advisor.lname,
advisor.fname, advisor.mi from student,
enrollment, advisor where
enrollment.stdid = cast(student.stdid as char(4)) and student.advid =
advisor.advid and enrollment.crs = row_data.crs
order by student.lname, student.fname, student.mi -- Insert the
title of a matching book into the text_output variable. text_output := text_output || row_data.crs ||''\n''; END end loop; -- Return the
list of books. RETURN
text_output; END; ' LANGUAGE 'plpgsql'; |
- [SQL] missing... at end of sql expression Justine . Cleary
- Re: [SQL] missing... at end of sql expression Tom Lane
- Re: [SQL] missing... at end of sql expression Michael Fuhr