MySQL Forums
Forum List  »  Triggers

Trigger to copy row before delete
Posted by: kamil kamil
Date: May 03, 2014 03:26PM

Hey,

I have a problem with trigger copying deleted row.

Original table: documents
Backup table: documents_backup

Table documents_backup has got 3 extra columns:

- id_pk (primary key)
- timestamp
- operation_type ('delete')

My trigger looks like this:

drop trigger if documents_deletetrigger;
DELIMITER
create trigger documents_deletetrigger
before delete on documents
for each row
begin

insert into values (NULL, CURRENT_TIMESTAMP, "delete", (select * from `documents` where id=old.id));

end;

While I'm trying to delete row from table `documents` i have an error:

'Operand should contain 1 column'

I'll be grateful for any clues. :)

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger to copy row before delete
8364
May 03, 2014 03:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.