求助:我下面的函数语法有问题吗?为甚么会一直报下面的错误

create function fun_fw_sfyczy(pi_operunitid varchar(2)) 
returns varchar(2)
LANGUAGE SQL 
BEGIN ATOMIC
     DECLARE v_count int;
     set v_count =(select count(1) from fw_operator where operunitid = int(pi_operunitid) and aae100 = '1');
     if v_count = 0 then
        return '0';
     end if;
     return '1';   
END

db2 创建function错误 sqlcode=-104

*************************************************************************************************************************************************

已解决,语法没问题

使用dbvisualier创建函数或存储过程,要加"--/"和"/"

--/

create function fun_fw_sfyczy(pi_operunitid varchar(2))

returns varchar(2)

LANGUAGE SQL

BEGIN ATOMIC

     DECLARE v_count int ;

     set v_count =(select count(1) from fw_operator where operunitid = int(pi_operunitid) and aae100 = '1');

     if v_count = 0 then

        return '0';

     end if;

     return '1';  

END

/

相关文章: