Re: Dynamic SQL Syntax help please

From: "Ruben Gouveia" <rubes7202(at)gmail(dot)com>
To: "Ivan Sergio Borgonovo" <mail(at)webthatworks(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Dynamic SQL Syntax help please
Date: 2008-09-04 21:07:34
Message-ID: 51e507b0809041407n798a5fe1u49f2d41aaf311623@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

thank you Sergio.

I decided to use

EXECUTE v_stmt into v_total_pop;

On Thu, Sep 4, 2008 at 2:00 PM, Ivan Sergio Borgonovo
<mail(at)webthatworks(dot)it>wrote:

> On Thu, 4 Sep 2008 13:41:16 -0700
> "Ruben Gouveia" <rubes7202(at)gmail(dot)com> wrote:
>
> > I created a simple function that i want to use another function
> > (in the same schema) that will be used to create a sql statement.
> > I get the following error when i try this:
> >
> > *ERROR: syntax error at or near "EXEC" at character 1
> > QUERY: EXEC SQL EXECUTE $1 INTO $2
> > CONTEXT: SQL statement in PL/PgSQL function "fcn_population" near
> > line 10
>
> > EXEC SQL EXECUTE v_stmt INTO v_total_pop;
>
> Could it be you're mixing MS SQL (Oracle?) syntax with pgplsql syntax
>
> EXECUTE v_stmt INTO v_total_pop;
>
>
> http://www.postgresql.org/docs/8.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
>
> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ruben Gouveia 2008-09-04 22:16:13 Correct Insert SQL syntax?
Previous Message Ivan Sergio Borgonovo 2008-09-04 21:00:55 Re: Dynamic SQL Syntax help please