Why MySQL refuses pipe ('|') character in string on INSERT INTO

If I try this statement:

INSERT INTO TerminalEventChild (id,stringValue) VALUES (64,'version123|'); 

MySQL error with:

 Error: 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 ''version123' at line 1 SQLState: 42000 ErrorCode: 1064 

If I remove | character, everything works fine. Any idea?

+7
sql mysql
source share
2 answers

On my machine, this works great:

 CREATE TABLE TerminalEventChild (id INT, stringValue VARCHAR(200)); INSERT INTO TerminalEventChild (id,stringValue) VALUES (64,'version123|'); 

It is likely that your client handles the character of the pipe on purpose.

Which client are you using?

+3
source share

I Found a Solution on Parsing Incorrect - ID: 3091322
Squirrel SQL uses the pipe symbol as a procedure / function separator, so you need to change your MySQL settings to use something else (like |||).

On the tab "File> Global Settings> MySQL" in the "Separator of procedures / functions", replace | with another line, for example |||.

+17
source share

All Articles