Thread: how to get table's name from variable ?

how to get table's name from variable ?

From
maack
Date:
Hi everybody,

I have a problem with getting a table's name from a 
variable.

example:

create function check_date(int4) returns date as '
declare 
my_date date ;
my_tablename text ;
begin
select tname into my_tablename from tw where id = $1 ;
select max(idate) into my_date from my_tablename where id = $1 ; 
return(my_date);
end;
' language 'plpgsql';

in the second select-query 'my_tablename' should give the (result-) 
tablename 
from the first query. How can this be done with postgres?

a friend has shown me the following  with oracle: 
select .... from &var ; 

is this possible with postgres too?

greetings+thanks,
Thomas