这是我的代码,我找不到错误!我试图创建一个函数,乘以一个值去输入参数,并返回该结果!这应该没有那么难,但我没有找到我的唯一错误
CREATE FUNCTION `Costotramite` (monto INT)
RETURNS INTEGER
BEGIN
NO SQL
DECLARE porcentaje FLOAT;
SET porcentaje = 0.1;
DECLARE CostoLicitacion INTEGER;
SET CostoLicitacion= (monto * porcentaje);
RETURN CostoLicitacion;
END
错误提示:错误码1064
DECLARE
必须在代码之前
我也把它改成了deterministic
CREATE FUNCTION `Costotramite` (monto INT) RETURNS INTEGER DETERMINISTIC BEGIN DECLARE porcentaje FLOAT; DECLARE CostoLicitacion INTEGER; SET porcentaje = 0.1; SET CostoLicitacion= (monto * porcentaje); RETURN CostoLicitacion; END
SELECT Costotramite(1000)
| Costotramite(1000) || -----------------: || 100 |
db<此处小提琴>此处小提琴>