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

From: Johan Nel <johan555(dot)nel555(at)xsinet555(dot)co(dot)za>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: syntax error at or near "IF"... why?
Date: 2009-04-30 07:12:47
Message-ID: gtbj2j$48n$1@news.eternal-september.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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;
> ^
> -----------------------------------------------------------
>
> For the if statement, i've tryed that
> IF 2 = 2 THEN
> ROLLBACK;
> END IF
>
> but still the error near the "IF"..
> dunno.. in mysql the if can be used in that way.. in postgres no?

Sorry was thinking FUNCTION way of doing it. DECLARE can only be used
in a stored procedure/function.

Johan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2009-04-30 08:25:25 Maintaining connectivity/failing gracefully when my application is connected to a PostgreSQL server over Wi-fi on a PDT/PDA handset
Previous Message DaNieL..! 2009-04-30 06:45:53 Re: ERROR: syntax error at or near "IF"... why?