Hello,
Is there a way to do variable interpolation in the SQL statements in
PLPGSQL? For example
suppose I wanted to write a generic routine that will search a given table
by its "id" field
like so:
CREATE FUNCTION search_by_id (TEXT, TEXT)
RETURNS RECORD
AS
'DECLARE rec RECORD;
BEGIN
SELECT INTO rec * FROM $1 WHERE id = $2;
RETURN rec;
END;'
LANGUAGE 'PLPGSQL';
Is this possible?
Sincerely,
Wade D. Oberpriller
StorageTek
612-424-1538