IntroductiontoPL/pgSQL

EXECUTE sql INTO v_count; RETURN v_count; END $$ LANGUAGE plpgsql; Note:Donotdothis.Validatetheparametersfirst. ExecuteUsing CREATE FUNCTION get_connection_count(p_role varchar) RETURNS integer AS $$ DECLARE v_count integer; sql varchar; BEGIN sql := 'SELECT count(*) FROM pg_stat_activity WHERE usename = $1'; EXECUTE sql INTO … ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download