2009/11/24 ramasubramanian <ramasubramania...@renaissance-it.com>:
> Dear All.
>     Can any one give me dynamic sql in postgres stored procedure using
> "USING CLAUSE"

CREATE TABLE tab(a integer);

CREATE OR REPLACE FUNCTION foo(_a integer)
RETURNS void AS $$
DECLARE r record;
BEGIN
  FOR r IN EXECUTE 'SELECT * FROM tab WHERE a = $1' USING _a LOOP
    RAISE NOTICE '%', r.a;
  END LOOP;
END;
$$ LANGUAGE plpgsql;

regards
Pavel Stehule



> Regards,
> Ram

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to