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 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.
-- 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,
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,
-- Insert the title of a matching book into the text_output variable.
text_output := text_output || row_data.crs ||''\n'';
-- Return the list of books.
' LANGUAGE 'plpgsql';
pgsql-sql by date
|Next:||From: Nick Peters||Date: 2004-11-18 21:01:58|
|Subject: Comparing Dates|
|Previous:||From: Riccardo G. Facchini||Date: 2004-11-18 12:38:31|
|Subject: Re: session_id|