Обсуждение: return data before the update

Поиск
Список
Период
Сортировка

return data before the update

От
Luis Silva
Дата:
Hi all,
Is it possible to perform an update and return the old data, i.e., the data updated? Do I need a store procedure?
I'm trying to perform this operation using JDBC, but I can't find a solution for this problem.
 
Kind regards,
LS


Hotmail: Powerful Free email with security by Microsoft. Get it now.

Re: return data before the update

От
Andreas Kretschmer
Дата:
Luis Silva <lfs12@hotmail.com> wrote:

> Hi all,
> Is it possible to perform an update and return the old data, i.e., the data
> updated? Do I need a store procedure?

What do you want to do with the old data? Store i a other table (like a
log-table)?

I think, you needs a TRIGGER, and the TRIGGER has to store the old
values in your log-table.

Do you know tablelog?
http://andreas.scherbaum.la/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: return data before the update

От
Luis Silva
Дата:
Thanks for the quick replay.
I wanted to return it when doing the update query.

> Date: Sat, 9 Jan 2010 07:47:32 +0100
> From: akretschmer@spamfence.net
> To: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] return data before the update
>
> Luis Silva <lfs12@hotmail.com> wrote:
>
> > Hi all,
> > Is it possible to perform an update and return the old data, i.e., the data
> > updated? Do I need a store procedure?
>
> What do you want to do with the old data? Store i a other table (like a
> log-table)?
>
> I think, you needs a TRIGGER, and the TRIGGER has to store the old
> values in your log-table.
>
> Do you know tablelog?
> http://andreas.scherbaum.la/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html
>
>
> Andreas
> --
> Really, I'm not out to destroy Microsoft. That will just be a completely
> unintentional side effect. (Linus Torvalds)
> "If I was god, I would recompile penguin with --enable-fly." (unknown)
> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice


Hotmail: Free, trusted and rich email service. Get it now.