Greetings,
I met a question about how to use *function variable *as the *table
name* to select count(*) into an integer variable for the table.
CREATE OR REPLACE FUNCTION update_code_map(VARCHAR, VARCHAR) RETURNS
VARCHAR AS $$
DECLARE
*tableName ALIAS FOR $1*;
*rec_num
Ying Lu wrote:
Greetings,
I met a question about how to use *function variable *as the *table
name* to select count(*) into an integer variable for the table.
Look at: FOR-IN-EXECUTE
http://www.postgresql.org/docs/8.0/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING
--
Thank you all for the helping.
I made a bit changes as the following and it works.
CREATE OR REPLACE FUNCTION update_code_map(VARCHAR, VARCHAR) RETURNS
VARCHAR AS $$
DECLARE
tableName ALIAS FOR $1;
st1_tabno_value ALIAS FOR $2;
rec_num INTEGER;