MySql存储功能不起作用(无结果)

时间:2019-05-11 10:29:40

标签: mysql stored-functions

我是第一次编写存储函数,我已经编写了下面的代码,我用谷歌搜索是否遇到了综合问题,但是没有找到任何解决方案,请您帮我

CREATE FUNCTION GetOrderTotalAmountTesting(order_id int)
 RETURNS decimal(10,2)
 BEGIN
 declare order_amount_total decimal(10,2);
 SELECT ((sum(calc_unit_price)*quantity)+sum(calc_tax)+sum(shipping_cost)) INTO order_amount_total from order_details det where det.order_id =order_id;
  RETURN order_amount_total;
 END 

以下是错误 错误 SQL查询:

CREATE FUNCTION GetOrderTotalAmountTestingassdasd(order_id int)
 RETURNS decimal(10,2)

 BEGIN
 declare order_amount_total decimal(10,2)

MySQL说:文档

  

#1064-您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册以获取正确的语法,以在第5行的''附近使用

0 个答案:

没有答案