create or replace trigger olaf_title_trg
	AFTER INSERT ON FABIAN_DATA
	FOR EACH ROW
	DECLARE
		VNumber	INTEGER;
		VIssueID VARCHAR2(255);
		VArticleID VARCHAR2(255);
		VTag  VARCHAR2(255);
		VVolume VARCHAR2(255);
	BEGIN
		select name into VTag from fabian_tag where id=:new.tagid;
		if (VTag = 'title') and (:new.data like '%Database%') then
			select parent into VArticleID from fabian_ptr where child=:new.tagid;		
			select parent into VIssueID from fabian_ptr where child=VArticleID;		
			select data into VVolume from fabian_data where tagid in (select id from fabian_tag where name='volume' and id in (select child from fabian_ptr where parent=VIssueID));
			select data into VNumber from fabian_data where tagid in (select id from fabian_tag where  name='number' and id in (select child from fabian_ptr where parent=VIssueID));
			Insert into fabian_art (articleid, volume, issue, title)  values (VArticleID, VVolume, VNumber, :new.data);
		end if;
	END;
/