how to use variable for select query in pl/pgsql

From: aBBISh <abbish(at)163(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to use variable for select query in pl/pgsql
Date: 2006-08-16 04:43:07
Message-ID: ebu7ov$18nd$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello everybody,

i want use a variable to denote a table name in select query.

for example:

DECLARE
table_message_data varchar;
record_message_data record;
BEGIN
table_message_data := prefix || 'message_data';

select into record_message_data * from table_message_data;
END;

the "prefix" is the function input parameter,but i don't know how to use
the "table_message_data" in select query.

please tell me,thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-08-16 05:05:29 Re: DB insert Error
Previous Message Jasbinder Bali 2006-08-16 04:38:42 Re: DB insert Error