Re: Cursor bug?

Поиск
Список
Период
Сортировка
От Mike G.
Тема Re: Cursor bug?
Дата
Msg-id 20050117060656.GB21453@thegodshalls.thegodshalls
обсуждение исходный текст
Ответ на Re: Cursor bug?  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Cursor bug?  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
On Fri, Jan 14, 2005 at 01:28:47PM +0100, Martijn van Oosterhout wrote:
> On Thu, Jan 13, 2005 at 04:35:04PM -0600, Mike G. wrote:
> > thank you.
> >
> > I use the cursor because I really do an update against a different
> > table based on a value from the select in the original table.  I am
> > eagerly awaiting 8.0 and the ability to issue an Update Table1 Set
> > Table1.col = Table2.col Using (Select y from Table2)
>
> What's this USING keyword you're referring to, I can't find it in the
> documentation anywhere, what does it do?

It doesn't look like it has been added to the documentation yet.  The only reference I could find to it was in the todo
list(create similiar ability for delete statement). 

USING allows you to add join statements to your update statement and use the data in the columns of the joined tables
asinput into the table the update is performed against. 

http://manuals.sybase.com/onlinebooks/group-as/asg1/250e/sqlug/@Generic_BookTextView/27741

>
> Beside, it's seems to me your entire function could be replaced by a
> single query:
>
> insert into temp_tables.delete_me
>      select name, file_number, question_to_change,
>             new_result, email
>      from source_table
>      where question_to_change = 'consultant'
>      and file_number is not NULL;
>
> or something like that, i didn't check the schema. But this is probably
> a cut down version. Tom's suggestion to use a FOR IN SELECT loop is a
> good one.
>
> Hope this helps,
> --
> Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.



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

Предыдущее
От: mstory@uchicago.edu
Дата:
Сообщение: deleting from arrays
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: deleting from arrays