'Select INTO" in Execute (dynamic query ) - Mailing list pgsql-sql

From Dinesh Pandey
Subject 'Select INTO" in Execute (dynamic query )
Date
Msg-id 20050418160800.A5165534BF@svr1.postgresql.org
Whole thread Raw
Responses Re: [GENERAL] 'Select INTO" in Execute (dynamic query )
List pgsql-sql

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



 

pgsql-sql by date:

Previous
From: "Philippe Lang"
Date:
Subject: Re: outer join in ms query
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] 'Select INTO" in Execute (dynamic query )