MySQL DECLARE/SELECT INTO Syntax error? -



MySQL DECLARE/SELECT INTO Syntax error? -

i have no thought i'm doing wrong here.

routine name: procinsertname type: procedure parameters: in name varchar 30 charset declare tempnameid int; select nameid tempnameid name value = @name; if tempnameid null insert name (value) values (@name); end if; deterministic: unchecked definer: <blank> security type: definer sql info access: contains sql comment: <blank>

i'm coming out error of:

one or more errors have occurred while processing request: next query has failed: "create procedure `procinsertname`(in `name` varchar(30)) not deterministic contains sql sql security definer declare tempnameid int; select nameid tempnameid name value = @name; if tempnameid null insert name (value) values (@name); end if;" mysql said: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'declare tempnameid int; select nameid tempnameid name valu' @ line 1

any help appreciated, i've spent lastly 30 minutes looking around online , can't find anything. thanks.

i think error might lying in @ symbol... must coming sql server background; mysql doesn't utilize @ notation variables parameter called name. seek rename name parameter p_name , replace 2 instances of @name p_name in body of stored proc.

i.e. this:

create procedure `procinsertname`(in `p_name` varchar(30)) not deterministic contains sql sql security definer declare tempnameid int; select nameid tempnameid name value = p_name; if tempnameid null insert name (value) values (p_name); end if;

mysql

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -