Re: Error when creating function in psotgresql 8.1

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: ben sewell <mosherben(at)gmail(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Error when creating function in psotgresql 8.1
Date: 2006-08-17 12:37:53
Message-ID: C109DB61.F98D%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 8/17/06 8:12 AM, "ben sewell" <mosherben(at)gmail(dot)com> wrote:

> Hi Sean, thanks for spotting the SQL syntax error.
>
> I had a look at another tutorial http://www.faqs.org/docs/ppbook/c19610.htm
> for
> more specific information to try have a go at sorting out my procedure. I've
> done changes after looking at it but now I'm getting a syntax error when I'm
> declaring a record variable which will return the data. I've attached the
> revised version if you want to have a look.
>
> Here's the list of errors when I execute the script:
>
> psql:reports_sp.txt:4: ERROR: syntax error at or near "declare" at
> charecter 270
> psql:reports_sp.txt:4: LINE 4: declare myrec record;
> psql:reports_sp.txt:4: ^
> psql:reports_sp.txt:18: ERROR : syntax error at or near "if" at charecter 13
> psql:reports_sp.txt:18: LINE 4: if report_id=18 then
> psql:reports_sp.txt:18: ^
> psql:reports_sp.txt:19: ERROR: syntax error at or near "return" at
> charecter 13
> psql:reports_sp.txt:19: LINE 1: return myrec;
> psql:reports_sp.txt:19: ^
> psql:reports_sp.txt:25: ERROR: syntax error at or near "else" at charecter
> 1
> psql:reports_sp.txt:25: LINE 1: else if reports_id=23 then
> psql:reports_sp.txt:25: ^
> psql:reports_sp.txt:29: ERROR: syntax error at or near "else" at charecter
> 1
> psql:reports_sp.txt:29: LINE 1: else if reports_id=25 then
> psql:reports_sp.txt:29: ^
> psql:reports_sp.txt:34: ERROR: syntax error at or near "else" at charecter
> 1 psql:reports_sp.txt:34: LINE 1: else if reports_id=25 then
> psql:reports_sp.txt:34: ^
> psql:reports_sp.txt:36: ERROR: syntax error at or near "return" at
> charecter 1 psql:reports_sp.txt:36: LINE 1: return myrec
> psql:reports_sp.txt:36 ^
> psql:reports_sp.txt:37: WARNING: there is no transaction in progress
> COMMIT
> psql:reports_sp.txt:39: ERROR: syntax error at or near "language" at
> charecter 1 psql:reports_sp.txt:39: LINE 1: language plpgsql;
> psql:reports_sp.txt:39: ^
>
> any ideas?

Ben,

You'll have to post the function definition.

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message ben sewell 2006-08-17 12:42:44 Re: Error when creating function in psotgresql 8.1
Previous Message ben sewell 2006-08-17 12:12:43 Re: Error when creating function in psotgresql 8.1