tablename as attribute in pgplsql

From: Benoît Bournon <benoit(dot)bournon(at)adelis(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: tablename as attribute in pgplsql
Date: 2003-05-22 15:46:25
Message-ID: 3ECCF0D1.8030705@adelis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-05-22 16:12:36 Re: Index Selection Problem
Previous Message Franco Bruno Borghesi 2003-05-22 15:26:58 Re: function prepared plan