56,803
社区成员




CREATE tigger 'tri_article_update' BEFORE UPDATE ON 't_article' FOR EACH ROW
BEGIN
IF (select COUNT(*) from t_article where cover=new.cover and content=new.content)=0
THEN INSERT into t_file (url,content) VALUES (new.cover,new.content)
END
CREATE TRIGGER 'tri_article_update' BEFORE UPDATE ON 't_article'
FOR EACH ROW
BEGIN
INSERT into t_file (url,content) VALUES (new.cover,new.content)
where NOT EXISTS(select * from t_article where cover=new.cover and content=new.content)
END
但是还是报错啊~
INSERT into t_file (url,content) VALUES (new.cover,new.content)
where not exists(select * from t_article where cover=new.cover and content=new.content)
dwcount int ;
select count(*) into dwcount from t_article
where cover=:new.cover and content=:new.content ;
IF dwcount = 0 then
INSERT into t_file (url,content) VALUES (:new.cover,:new.content) ;
end if ;
-- 用 先取出 count(*) 值 , new 前面要加冒号
dwcount int ;
select count(*) into dwcount from t_article
where cover=:new.cover and content=:new.content ;
IF dwcount = 0 then
INSERT into t_file (url,content) VALUES (new.cover,new.content) ;
end if ;