Re: How to declare cursor if tablename is a variable?
От | Michael Fuhr |
---|---|
Тема | Re: How to declare cursor if tablename is a variable? |
Дата | |
Msg-id | 20070323114703.GA76452@winnie.fuhr.org обсуждение исходный текст |
Ответ на | Re: How to declare cursor if tablename is a variable? (Michael Fuhr <mike@fuhr.org>) |
Список | pgsql-sql |
On Wed, Mar 21, 2007 at 02:20:21AM +0000, hu js wrote: > But I get into another trouble.See following program. As I requested before, please post questions to the mailing list so others can participate in and learn from the discussion. > "query_xypos" is ok. but "query_xydata" is not ok. > I find "objectid" not quoted corrected.It seems relevant with variable > varchar and "'". [...] > query_xypos text := 'SELECT mrc_xy_position FROM ' || > quote_ident(tablename); > query_xydata text := 'SELECT x,y FROM ' || tablename || ' where > mrc_xy_position = ' || quote_ident(objectid) ; See the documentation to learn more about quote_ident() and quote_literal() and when to use each: http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN http://www.postgresql.org/docs/8.2/interactive/functions-string.html#FUNCTIONS-STRING-OTHER -- Michael Fuhr
В списке pgsql-sql по дате отправления: