1
我可以傳遞視圖的名稱作爲函數的參數嗎?例如:將視圖的名稱作爲參數傳遞給函數
CREATE OR REPLACE FUNCTION example_test(test type_view) return void as $$
BEGIN
start_ts = CLOCK_TIMESTAMP();
REFRESH MATERIALIZED VIEW test;
GET DIAGNOSTICS total_rows = ROW_COUNT;
INSERT INTO control_dw_monitoring (name, start_time, end_time, total)
VALUES ('view points that never contacted', start_ts, CLOCK_TIMESTAMP(), total_rows);
END
$$ language plpgsql;
你需要爲這個動態SQL:http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL -STATEMENTS-EXECUTING-DYN – 2015-02-09 12:27:10
[那麼你有答案嗎?](http://meta.stackexchange.com/a/5235/169168) – 2015-07-24 03:21:25