触发器语法错误 求指教

meran 2013-06-17 07:46:28

create FUNCTION f_get_triggerinfo(v_alarm_event_id int) returns int
begin
declare v_ret int;
select
(case when (exists (select 1 from alarm_trigger_client where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 1 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_email where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 10 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_io where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 100 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_message where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 1000 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_popup_video where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 10000 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_preset where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 100000 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_tvwall where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 1000000 else 0 end case)
+
(case when (exists (select 1 from alarm_trigger_vrm where alarm_event_id=alarm_event.alarm_event_id and valid_flag='1')) then 10000000 else 0 end case)
into v_ret
from alarm_event where alarm_event_id=v_alarm_event_id;
return v_ret;
end;



求指教啊亲
...全文
159 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
meran 2013-06-17
  • 打赏
  • 举报
回复
手抖了了,是函数错误。。。提示第5行语法错误
ACMAIN_CHM 2013-06-17
  • 打赏
  • 举报
回复
错误提示是什么? 另外这也不是创建TRIGGER是,是创建一个存储函数。

56,940

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧