Re: ERROR: syntax error at or near "IF"... why?

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: "DaNieL(dot)(dot)!" <daniele(dot)pignedoli(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: syntax error at or near "IF"... why?
Date: 2009-04-30 22:49:25
Message-ID: 49FA2AF5.90801@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 30/04/2009 07:45, DaNieL..! wrote:

> I tryed the declare, before and after the BEGIN;, but allways returns
> me the error:
> -----------------------------------------------------------
> ERROR: syntax error at or near "int";
> LINE 1: DECLARE _mycredit int;
> ^
> -----------------------------------------------------------

I missed what came before in this thread, but in plpgsql functions the
DECLARE comes before BEGIN:

create or replace function my_function() returns....
as
$$
declare
....
begin
....
return....
end;
$$
language plpgsql;

Can you show us the full function code again please?

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2009-05-01 01:19:08 08P01: unexpected EOF on client connection
Previous Message Alan Hodgson 2009-04-30 22:19:25 Re: pg_dump and pg_restore problem