Обсуждение: determining current table & record within stored procedure ?

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

determining current table & record within stored procedure ?

От
"paul"
Дата:
Hi there, we're trying to accomplish the following;

in case of update/deletion in some tables we want to copy the record (for
history purposes) to a history table using a trigger.
example:

in a program the statement "delete from names where name="Smith" is going to
be executed on the server. I want to create a trigger ;

"create trigger <somename> before delete or update on <names> execute
<somefunc>

In this function <somefunc> I want to clone the current record wich is being
deleted/updated to another table with the same name prefixed by "history_"
so in this example to <history_names>.

Any ideas ?
I'd like to be able to test for the tablename & current record, in the
function wich is being called

thanks in advance
Paul

paulinfo@zeelandnet.nl