pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dinesh Pandey <dpandey@secf.com>
To: pgsql-sql@postgresql.org
To: pgsql-general@postgresql.org
Subject: 'Select INTO" in Execute (dynamic query )
Date: Mon, 18 Apr 2005 21:34:48 +0530
Message-ID: <20050418160800.A5165534BF@svr1.postgresql.org> (raw)

Hi

 

What's wrong with this code (ERROR:  syntax error at or near "INTO" at
character 8)?

 

Problem: I want to put A1, A2 values in two variables vara, varb.

 

CREATE OR REPLACE FUNCTION test(text) 

RETURNS VARCHAR AS $$

Declare

          vara    VARCHAR(10) :='';

          varb    VARCHAR(10) :='';

          result  VARCHAR(10) :='Result';

          

BEGIN           

          EXECUTE(

                   'Select INTO vara, varb A1, A2 from '|| $1 

          );

          

RETURN result||': '|| vara ||' '|| varb;

 

END;

$$ LANGUAGE plpgsql;

 

 

Regards
Dinesh Pandey




 

view thread (3+ messages)  latest in thread

Message-ID: <20050418160800.A5165534BF@svr1.postgresql.org>
Permalink:  ../20050418160800.A5165534BF@svr1.postgresql.org/
Also on:    postgresql.org/message-id/20050418160800.A5165534BF@svr1.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dpandey@secf.com, pgsql-general@postgresql.org
  Subject: Re: 'Select INTO" in Execute (dynamic query )
  In-Reply-To: <20050418160800.A5165534BF@svr1.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox