MySQL Trigger - Storing a SELECT in a variable

后端 未结 6 1327
孤独总比滥情好
孤独总比滥情好 2020-12-02 22:16

I have a trigger in which I want to have a variable that holds an INT I get from a SELECT, so I can use it in two IF statements instead of calling the SEL

6条回答
  •  情书的邮戳
    2020-12-02 22:28

    Or you can just include the SELECT statement in the SQL that's invoking the trigger, so its passed in as one of the columns in the trigger row(s). As long as you're certain it will infallibly return only one row (hence one value). (And, of course, it must not return a value that interacts with the logic in the trigger, but that's true in any case.)

提交回复
热议问题