0

以下是过程中的部分代码:

if p_vendor_id is null then set v_msg := 'Error: parameters are not valid'
    elseif p_vendor_id not in (select vendor_id from p_plants.vendors) then
        set v_msg := 'Error: vendor id parameter is not a vendor in our tables'

我收到一个语法错误else if...not in。如何测试一个值是否在列表中?

谢谢!

4

1 回答 1

0

语法不正确,你应该使用分号和end if

if p_vendor_id is null then set v_msg := 'Error: parameters are not valid';
elseif p_vendor_id not in (select vendor_id from p_plants.vendors) then
    set v_msg := 'Error: vendor id parameter is not a vendor in our tables';
end if;

文档中有一个示例:http: //dev.mysql.com/doc/refman/5.0/en/if.html

于 2014-02-23T10:02:57.083 回答