Re: select into

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: select into
Дата
Msg-id 1138.1164212062@sss.pgh.pa.us
обсуждение исходный текст
Ответ на select into  (Mulham freshcode <mulhamcode@yahoo.com>)
Список pgsql-sql
Mulham freshcode <mulhamcode@yahoo.com> writes:
>    Am new to sql scripting so this might be a stupid question. Am getting an error while trying to do the following
> SELECT INTO svc_data_rec * from svc_tbl_name where 'uid' = sub_id;

The error message shows that this is getting rewritten into

>    QUERY:  SELECT  * from  $1  where 'uid' =  $2

so the problem is that you are using svc_tbl_name as a plpgsql variable,
and plpgsql is not bright enough to realize that it shouldn't substitute
the variable value at this particular spot in the query.  You need to
change the variable name to something that won't conflict.  In general,
don't use plpgsql variables that are named the same as any SQL tables or
columns you need to mention in the function.
        regards, tom lane


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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: select into
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: select into