Skip site navigation (1) Skip section navigation (2)

Re: How to successfully create a new function?

From: Jim Moon <moonjamesg(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to successfully create a new function?
Date: 2012-04-03 17:22:09
Message-ID: CAMW+QwHZHYJwbpyC_TOarVLrptr79Udjzz5Ju=kg9hyoe4KLPQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Thank you all again.  This works:

CREATE OR REPLACE FUNCTION "sp_SetScenario"(scen character varying) RETURNS
void AS $$
DECLARE sqlStatement varchar(500);
BEGIN
    sqlStatement = 'ALTER USER postgres WITH DEFAULT_SCHEMA = ' || scen;
    EXECUTE(sqlStatement);
END;
$$
LANGUAGE 'plpgsql'


I removed SET from:
      SET sqlStatement = 'ALTER USER postgres ...

I changed:
     EXEC(sqlStatement);
to:
     EXECUTE(sqlStatement);


Jim

pgsql-novice by date

Next:From: AndrejDate: 2012-04-03 20:18:17
Subject: Re: How to connect to remote instance?
Previous:From: Andreas KretschmerDate: 2012-04-03 17:06:06
Subject: Re: How to successfully create a new function?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group