2009/11/24 ramasubramanian <ramasubramanian(dot)g(at)renaissance-it(dot)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