开发者

Constants in the triggers in MySQL

I'm trying to create a trigger in MySQL. I need to use some values (constants) at several times within the trigger. How can I define a constant in order t开发者_运维知识库o make my trigger more maintainable and don't have numeric values spread along the code.

(Maybe is an stupid question but I'm a starter with MySQL)

Thanks in advance


As NullUserException stated, DECLARE is what you need. (The syntax he indicated is wrong however).

The syntax is

DECLARE var_name type DEFAULT value;

example

DECLARE someConstant int DEFAULT 10;

if you leave off DEFAULT the initial value will be NULL. (IE: DECLARE var_name type;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜