Re: error while generating and EXECUTEing a query dynamically

From: Gaurav Priyolkar <pgaurav(at)goatelecom(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: error while generating and EXECUTEing a query dynamically
Date: 2001-09-13 17:55:56
Message-ID: 20010913232556.C701@goatelecom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 12, 2001 at 11:45:16PM +0530, Gaurav Priyolkar wrote:
> Hi all,
>
> The machine I am sending this mail from does not have postgres, but I
> did this just this morning so am typing from memory:
>
> <code>
>
> CREATE FUNCTION footable() RETURNS INTEGER AS '
>
> DECLARE
> sql VARCHAR(1000);
>
> BEGIN
>
> sql := ''CREATE TABLE foo (x INT, y CHAR) '';
>
> EXECUTE sql;
>
> RETURN 1;
>
> END;
> ' LANGUAGE 'plpgsql';
>
>
> <code>
>
>
> Now when I try to execute this function I get an error message saying
>
> <error>
> parse error at or near ""
> <error>
>
>
> I will get the exact function and error output from other machine
> tomorrow (the actual query I am generating is more complex) but in the
> meantime if anyone can help with this example, I would be most
> grateful. Where am I going wrong?
>
> TIA
>
> Gaurav
>
>
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
Sleep: A completely inadequate substitute for caffeine.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message wsheldah 2001-09-13 18:49:35 Re: business perspective
Previous Message Ryan Mahoney 2001-09-13 17:37:40 Re: business perspective