Re: tablename as attribute in pgplsql - Mailing list pgsql-sql

From Benoît Bournon
Subject Re: tablename as attribute in pgplsql
Date
Msg-id 3ECDCFFB.1090808@adelis.com
Whole thread Raw
In response to Re: tablename as attribute in pgplsql  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: tablename as attribute in pgplsql
List pgsql-sql
It is not possible tu use a specific argument ? type table or tablename ?<br /><br /> execute is not runnig <br /><br
/>Stephan Szabo a écrit:<br /><blockquote cite="mid20030522184108.C51260-100000@megazone23.bigpanda.com"
type="cite"><prewrap="">On Thu, 22 May 2003, [ISO-8859-1] Beno?t Bournon wrote:
 
 </pre><blockquote type="cite"><pre wrap="">DECLARE  usertablename ALIAS FOR $1 ;  userid ALIAS FOR $2 ;
  id_lang BIGINT ;
  var VARCHAR(200) ;

BEGIN     var := 'client' ;
     SELECT id_language INTO id_lang FROM client WHERE id_user = userid ;     IF NOT (id_lang = 1 OR id_lang = 3) THEN
      id_lang = 1 ;     END IF ;
 
     RETURN id_lang ;

END ;

I want to use client table as a variable

How could I do   </pre></blockquote><pre wrap="">
Look at the documentation for EXECUTE.  Unfortunately using EXECUTE into a
variable is a little complicated right now AFAIR because you can't using
select ... INTO variable inside the execute, but instead need to use
something like for in execute loop.



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

<a class="moz-txt-link-freetext"
href="http://www.postgresql.org/docs/faqs/FAQ.html">http://www.postgresql.org/docs/faqs/FAQ.html</a>
 </pre></blockquote>

pgsql-sql by date:

Previous
From: "Johann Thoyer"
Date:
Subject: pg_connect
Next
From: Chadwick Rolfs
Date:
Subject: Re: [PHP] faster output from php and postgres