UniSQL Exec mysql script is Error !
Posted: Thu 04 Dec 2014 06:37
HI support
exec mysql script is Error !
var
FileName:string;
begin
FileName:='D:\FN_ECP_SCM_SplitStr.sql';
UniSQL1.SQL.LoadFromFile(FileName,TEncoding.UTF8);
UniSQL1.Execute;
Project Project1.exe raised exception class EMySqlException with message '
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter //
DROP FUNCTION if exists FN_ECP_SCM_SplitStr;
//
Create FUNCTI' at line 1'.
---------------------------
Break Continue Help
---------------------------
-- this is mysql script content
delimiter //
DROP FUNCTION if exists FN_ECP_SCM_SplitStr;
//
Create FUNCTION FN_ECP_SCM_SplitStr(
pStr nvarchar(2000),
pSeparator nvarchar(10),
pIndex int
)
RETURNS nvarchar(200)
BEGIN
declare viIndex int;
declare vNum int;
declare vTempStr nvarchar(2000);
declare vRstStr nvarchar(100);
set vNum=0;
set vRstStr='';
set vTempStr=pStr;
set viIndex =LOCATE(pSeparator,vTempStr);
if viIndex>=1 then
loop_Start1:loop
set vNum=vNum + 1;
if pIndex=vNum then
set vRstStr=LEFT(vTempStr,viIndex-1);
leave loop_Start1;
end if;
set vTempStr=substring(vTempStr,viIndex + 1);
set viIndex =LOCATE(pSeparator,vTempStr);
if viIndex<1 then
leave loop_Start1;
end if;
end loop;
end if;
if pIndex=vNum + 1 and vTempStr<>'' then
set vRstStr=vTempStr;
end if;
return vRstStr;
END;
//
exec mysql script is Error !
var
FileName:string;
begin
FileName:='D:\FN_ECP_SCM_SplitStr.sql';
UniSQL1.SQL.LoadFromFile(FileName,TEncoding.UTF8);
UniSQL1.Execute;
Project Project1.exe raised exception class EMySqlException with message '
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter //
DROP FUNCTION if exists FN_ECP_SCM_SplitStr;
//
Create FUNCTI' at line 1'.
---------------------------
Break Continue Help
---------------------------
-- this is mysql script content
delimiter //
DROP FUNCTION if exists FN_ECP_SCM_SplitStr;
//
Create FUNCTION FN_ECP_SCM_SplitStr(
pStr nvarchar(2000),
pSeparator nvarchar(10),
pIndex int
)
RETURNS nvarchar(200)
BEGIN
declare viIndex int;
declare vNum int;
declare vTempStr nvarchar(2000);
declare vRstStr nvarchar(100);
set vNum=0;
set vRstStr='';
set vTempStr=pStr;
set viIndex =LOCATE(pSeparator,vTempStr);
if viIndex>=1 then
loop_Start1:loop
set vNum=vNum + 1;
if pIndex=vNum then
set vRstStr=LEFT(vTempStr,viIndex-1);
leave loop_Start1;
end if;
set vTempStr=substring(vTempStr,viIndex + 1);
set viIndex =LOCATE(pSeparator,vTempStr);
if viIndex<1 then
leave loop_Start1;
end if;
end loop;
end if;
if pIndex=vNum + 1 and vTempStr<>'' then
set vRstStr=vTempStr;
end if;
return vRstStr;
END;
//