わかりました..これは奇妙に見えるかもしれませんが、ifステートメントの複数の条件の中でどの条件が満たされたかを見つける方法はありますか? MySql 5.1 でトリガーを作成していますが、特定の条件でエラーを発生させる必要があります。以下のコードのようなことをしたいのですが、
if(new.col1 = 'A' and (new.col2 is null or new.col3 is null) {
//if new.col1 = 'A' and **new.col2** was null
set msg = '<col2> cannot be null';
}
if(new.col1 = 'B' and (new.col4 is null or new.col5 is null) {
//if new.col1 = 'B'and **new.col5** was null
set msg = '<col5> cannot be null';
}
これに対する解決策が得られれば、1000 秒のif
ループを節約できます!!!