I have a mysql test.sql file that contains stored procedure. to load this sql file after connecting to database in go server, I used Exec command. But I haven't got the result I wanted. I take error code
1064 You have an error in your SQL syntax; check the manual that corr...
How can I load stored procedure from a sql file after connecting the database in go.
// go code section :
sqlProc, err := ioutil.ReadFile("E:/Qlass/goserv/src/cevir/test.sql")
// handle error
_, err = MAPP.DB.Db.Exec(string(sqlProc[:]))
// handle error
// content of test.sql
drop procedure if exists Test;
delimiter ;;
create procedure Test()
begin
truncate table _prlog;
end ;;
delimiter ;
problem is caused by the delimeter command. I removed those lines. Problem is solved. The corrected sql file.
drop procedure if exists Test;
create procedure Test()
begin
truncate table _prlog;
end ;