help with dynamic table name
От
Peter Schonefeld
Тема
help with dynamic table name
Дата
Msg-id
9cc0d1180703051959n7a9beeafp5af897c7b5c41af9@mail.gmail.com
Список
Дерево обсуждения
help with dynamic table name "Peter Schonefeld" <peter.schonefeld@gmail.com>
Re: help with dynamic table name "Jasbinder Singh Bali" <jsbali@gmail.com>
Re: help with dynamic table name Tom Lane <tgl@sss.pgh.pa.us>
Re: help with dynamic table name Michael Fuhr <mike@fuhr.org>
Re: help with dynamic table name "Jasbinder Singh Bali" <jsbali@gmail.com>
Re: help with dynamic table name "Peter Schonefeld" <peter.schonefeld@gmail.com>
Re: help with dynamic table name Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: help with dynamic table name "Peter Schonefeld" <peter.schonefeld@gmail.com>
Re: help with dynamic table name "Jasbinder Singh Bali" <jsbali@gmail.com>
Re: help with dynamic table name "Jasbinder Singh Bali" <jsbali@gmail.com>
Re: help with dynamic table name "Peter Schonefeld" <peter.schonefeld@gmail.com>
Re: help with dynamic table name Tom Lane <tgl@sss.pgh.pa.us>
Re: help with dynamic table name "Jasbinder Singh Bali" <jsbali@gmail.com>
Hi, could someone please let me know what i'm doing wrong here?
CREATE OR REPLACE FUNCTION sc_insert_row(char(32),text,varchar(32)) RETURNS text AS $$
DECLARE sql text;
BEGIN
sql := "INSERT INTO "+ $3 +" ('id','body') VALUES ("+ $1 +","+ $2 +")";
EXECUTE sql;
RETURN '';
END;
$$ LANGUAGE 'plpgsql' VOLATILE;
I get the error: "ERROR: 42703: column \"INSERT INTO \" does not exist"
Cheers
Pete
CREATE OR REPLACE FUNCTION sc_insert_row(char(32),text,varchar(32)) RETURNS text AS $$
DECLARE sql text;
BEGIN
sql := "INSERT INTO "+ $3 +" ('id','body') VALUES ("+ $1 +","+ $2 +")";
EXECUTE sql;
RETURN '';
END;
$$ LANGUAGE 'plpgsql' VOLATILE;
I get the error: "ERROR: 42703: column \"INSERT INTO \" does not exist"
Cheers
Pete
В списке pgsql-novice по дате отправления