James
James

Reputation: 429

Creating mysql Function with parameters

delimeter //
DROP function IF EXISTS get_seq_next//
create function get_seq_next(
IN sequence_ref_ varchar(30)
) returns int(11) unsigned
BEGIN
    DECLARE seq_val_  int(11) unsigned;
    LOCK TABLE ga_seq_tab WRITE;
    select sequence_no into seq_val_ from ga_seq_tab where sequence_ref=sequence_ref_;
    if not seq_val_ is null then
        update ga_seq_tab set sequence_no=sequence_no+1 where sequence_ref=sequence_ref_;
    end if
    UNLOCK TABLES;
    return seq_val;
END //
DELIMETER ;

I'm trying to create a function but it keeps saying I have syntax errors and I am not sure what is wrong with it

Upvotes: 1

Views: 1961

Answers (1)

Al3x
Al3x

Reputation: 125

Try removing the IN reserved word in the parameters list.

Upvotes: 1

Related Questions