roncoo / roncoo-pay

龙果支付系统(roncoo-pay)是国内首款开源的互联网支付系统,拥有独立的账户体系、用户体系、支付接入体系、支付交易体系、对账清结算体系。目标是打造一款集成主流支付方式且轻量易用的支付收款系统,满足互联网业务系统打通支付通道实现支付收款和业务资金管理等功能。
https://pay.roncoo.net
Apache License 2.0
4.85k stars 2.57k forks source link

sql 执行错误 #12

Open yiyebaofu2 opened 8 years ago

yiyebaofu2 commented 8 years ago

执行 database.sql 的时候创建function错误 mysql版本5.7

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURN FUN_SEQ_CURRENT_VALUE(SEQ)' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 ERROR 1193 (HY000): Unknown system variable 'VALUE' ERROR 1327 (42000): Undeclared variable: VALUE ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURN VALUE' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURN FUN_SEQ_CURRENT_VALUE(SEQ)' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1

leslie52 commented 8 years ago

两个办法:

  1. 用Navicat for MySQL这个工具 导入脚本
  2. 脚本中 创建函数处加转义符处理
zhaodp commented 7 years ago

对创建函数处做如下改动,即可顺利导入:

delimiter //

CREATE FUNCTION FUN_SEQ(SEQ VARCHAR(50)) RETURNS BIGINT(20) BEGIN UPDATE SEQ_TABLE SET CURRENT_VALUE = CURRENT_VALUE + INCREMENT WHERE SEQ_NAME=SEQ; RETURN FUN_SEQ_CURRENT_VALUE(SEQ); END //

CREATE FUNCTION FUN_SEQ_CURRENT_VALUE(SEQ VARCHAR(50)) RETURNS BIGINT(20) BEGIN DECLARE VALUE INTEGER; SET VALUE=0; SELECT CURRENT_VALUE INTO VALUE FROM SEQ_TABLE WHERE SEQ_NAME=SEQ; RETURN VALUE; END //

CREATE FUNCTION FUN_SEQ_SET_VALUE(SEQ VARCHAR(50), VALUE INTEGER) RETURNS BIGINT(20) BEGIN UPDATE SEQ_TABLE SET CURRENT_VALUE=VALUE WHERE SEQ_NAME=SEQ; RETURN FUN_SEQ_CURRENT_VALUE(SEQ); END //

CREATE FUNCTION FUN_NOW() RETURNS DATETIME BEGIN RETURN now(); END //

-- 时间函数

CREATE FUNCTION FUN_DATE_ADD(STR_DATE VARCHAR(10), STR_INTERVAL INTEGER) RETURNS DATE BEGIN RETURN date_add(STR_DATE, INTERVAL STR_INTERVAL DAY); END //

delimiter ;