DELIMITER

With DELIMITER you can specify the end of SQL statement to another character, not “;”.

mysql> DELIMITER //
mysql> create definer = 'user'@'%' function 'msec'() returns char(26) charset sjis
    -> BEGIN
    -> return ( select replace(replace(Now(6), ' ','-'), ':', '.') from dual);
    -> END
    -> //
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 ''msec'() returns char(26) charset sjis
BEGIN
return ( select replace(replace(Now' at line 1

create table clog (
 CAMPAIGN_CODE char(5) NOT NULL,
 ENO char(40) NOT NULL,
 LINK_ITEM_NO char(3) NOT NULL,
 CLICKSTAMP char(26) NOT NULL,
 FREE1 varchar(253) DEFAULT NULL,
 FREE2 varchar(253) DEFAULT NULL,
 FREE3 varchar(253) DEFAULT NULL,
 FREE4 varchar(253) DEFAULT NULL,
 FREE5 varchar(253) DEFAULT NULL,
 FREE6 varchar(253) DEFAULT NULL,
 FREE7 varchar(253) DEFAULT NULL,
 FREE8 varchar(253) DEFAULT NULL,
 FREE9 varchar(253) DEFAULT NULL,
 FREE10 varchar(253) DEFAULT NULL,
 INSSTAMP char(26) NOT NULL,
 UPDSTAMP char(26) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=sjis;

create table cre (
 CAMPAIGN_CODE char(5) NOT NULL,
 LINO char(3) NOT NULL,
 START_DATE date NOT NULL,
 START_TIME char(4) NOT NULL,
 END_DATE date NOT NULL,
 END_TIME char(4) NOT NULL,
 MLURL varchar(512) NOT NULL,
 FREE1 varchar(253) DEFAULT NULL,
 FREE2 varchar(253) DEFAULT NULL,
 FREE3 varchar(253) DEFAULT NULL,
 FREE4 varchar(253) DEFAULT NULL,
 FREE5 varchar(253) DEFAULT NULL,
 FREE6 varchar(253) DEFAULT NULL,
 FREE7 varchar(253) DEFAULT NULL,
 FREE8 varchar(253) DEFAULT NULL,
 FREE9 varchar(253) DEFAULT NULL,
 FREE10 varchar(253) DEFAULT NULL,
 INSSTAMP char(26) NOT NULL,
 UPDSTAMP char(26) NOT NULL,
 PRIMARY KEY(CAMPAIGN_CODE, LINO),
 UNIQUE KEY SQL0123456(CAMPAIGN_CODE, LINO)
) ENGINE=InnoDB DEFAULT CHARSET=sjis;

DELIMITER
create definer = 'user'@'%' function 'msec'() returns char(26) charset sjis
BEGIN
  return ( select replace(replace(Now(6), ' ','-'), ':', '.') from dual);
END
//
DELIMITER ;


insert into cre (
 CAMPAIGN_CODE,
 LINO,
 START_DATE,
 START_TIME,
 END_DATE,
 ENT_TIME,
 MLURL,
 INSSTAMP,
 UPDSTAMP
) values (
 '00AF',
 '001',
 '2019-01-01',
 '0000',
 '2022-12-31',
 '2345',
 'http://localhost',
 '2019-01-01-00.00.00.000000',
 '2019-01-01-00.00.00.000000'
);