MySQL Forums
Forum List  »  Triggers

Set up trigger
Posted by: Jakub Kalinowski
Date: April 05, 2014 11:22AM

Hello,

I've got problem with set up trigger in my database.

I first table 'biblioitems' looks like below:

biblionumber
2

Marcxml
<datafield tag="245" ind1="1" ind2="0">
<subfield code="a">Burza piaskowa /</subfield>
<subfield code="c">Roman Samsel.</subfield>
</datafield>



I set up trigger, but it doesn't work correct.


delimiter //
CREATE TRIGGER `title_from_245` AFTER INSERT ON biblioitems
FOR EACH ROW BEGIN

INSERT INTO antykwariat_posts (biblio_id, post_title)

SELECT NEW.biblionumber, ExtractValue(NEW.marcxml, '//datafield[@tag="245"]/subfield[@code>="a"]') from biblioitems;

END;
//
delimiter ;



When I add something to table 'biblioitems' my server add row to table 'antykwariat_post', but there is only biblio_id, post_title is still empty.

Could you tell me what is wrong?

Options: ReplyQuote


Subject
Views
Written By
Posted
Set up trigger
2703
April 05, 2014 11:22AM
1206
April 07, 2014 09:07AM
1075
April 07, 2014 09:44AM


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.