Re: ERROR: syntax error at or near "IF"... why? - Mailing list pgsql-general

From Johan Nel
Subject Re: ERROR: syntax error at or near "IF"... why?
Date
Msg-id gtbj2j$48n$1@news.eternal-september.org
Whole thread Raw
In response to Re: ERROR: syntax error at or near "IF"... why?  ("DaNieL..!" <daniele.pignedoli@gmail.com>)
List 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

pgsql-general by date:

Previous
From: Dennis Brakhane
Date:
Subject: Re: delete duplicates takes too long
Next
From: Alan Hodgson
Date:
Subject: Re: possible consistency problem