Re: execute if statement

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Peter Kroon <plakroon(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: execute if statement
Date: 2012-12-01 20:04:59
Message-ID: 50BA62EB.3020002@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/12/2012 19:44, Peter Kroon wrote:
> Mmmmm.......
>
> How do I execute dynamic sql that starts with an if statement.
> I'm converting mssql code to pgsql.
>

Without trying it, I'd guess that you need to have the IF outside the
dynamic code, something like this:

if .... then
execute '.....';
end if;

If you show what you're trying to achieve, someone might be able to
suggest something better.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Edson Richter 2012-12-01 23:20:42 Re: Revoke "drop database" even for superusers?
Previous Message Peter Kroon 2012-12-01 19:59:38 Re: execute if statement