how to get table's name from variable ?

Поиск
Список
Период
Сортировка
От maack
Тема how to get table's name from variable ?
Дата
Msg-id Pine.SUN.3.91.990601041404.18281A-100000@aries.zrz.TU-Berlin.DE
обсуждение исходный текст
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Pham, Thinh"
Дата:
Сообщение: Column name's length
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] Column name's length