faizal
faizal

Reputation: 3565

syntax error in create function MySql

I am getting a syntax error with this simple sample script in MySql 5.6.17 :

CREATE FUNCTION sampldb.fn_x(param VARCHAR(20))
RETURNS int
BEGIN
return 1;
END

What am i doing wrong? In Sql workbench, the error is shown in the last 2 lines.

Upvotes: 0

Views: 991

Answers (1)

ashishmaurya
ashishmaurya

Reputation: 1196

use DELIMITER

DELIMITER //
CREATE FUNCTION sampldb.fn_x(param VARCHAR(20))
RETURNS int
BEGIN
return 1;
END
//

Upvotes: 3

Related Questions