Re: help with dynamic table name

Поиск
Список
Период
Сортировка
От Peter Schonefeld
Тема Re: help with dynamic table name
Дата
Msg-id 9cc0d1180703052112o26fc8c2bs18a1b02a68dd5ec1@mail.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>)
Список pgsql-novice
Still no joy...if i forget about the variables and just try buidling a string to execute, eg:

sql := 'INSERT INTO application (id,body) VALUES (''asdf'',''lkjh'')';
 
It works.

but with the variables i still get an error...

I tried putting quotes (two single quote chars) around the VALUES variables

  sql := 'INSERT INTO '+ $3 +' (id,body) VALUES ('''+ $1 +''','''+ $2 +''')';

but it still will not work. "ERROR: 42883: operator does not exist: \"unknown\" + character varying"

Pete


On 3/6/07, Jasbinder Singh Bali < jsbali@gmail.com> wrote:
 
sql := 'INSERT INTO '+ $3 +' (id,body) VALUES ('+ $1 +','+ $2 +')';
remove the double quotes with id and body and see if it works.
~Jas

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Peter Schonefeld"
Дата:
Сообщение: Re: help with dynamic table name
Следующее
От: "Jasbinder Singh Bali"
Дата:
Сообщение: Re: help with dynamic table name