Andrej
Andrej

Reputation: 3839

MariaDB and 1064 error

I get the following error when I execute the code below:

ERROR 1064 (42000) at line 21: You have an error in your SQL syntax; chech the manual that corresponds to your MariaDB server version for the right syntax to use near @LINE_TERMINATION@

Here is the code that I use to create table:

CREATE TABLE SRDEF (
    RT  VARCHAR (3) BINARY NOT NULL,
    UI  CHAR (4) BINARY NOT NULL,
    STY_RL  VARCHAR (41) BINARY NOT NULL,
    STN_RTN VARCHAR (14) BINARY NOT NULL,
    EX  VARCHAR (185) BINARY
) CHARACTER SET utf8;

And here is the code I use to populate table:

load data local infile 'SRDEF' into table SRDEF fields terminated by '|' 
ESCAPED BY '' lines terminated by @LINE_TERMINATION@
(@rt, @ui, @sty_rl, @stn_rtn, @ex)
SET RT = @rt,
UI = @ui,
STY_RL = @sty_rl,
STN_RTN = @stn_rtn,
EX = NULLIF(@ex,'');

Any advice is greatly appreciated.

Upvotes: 3

Views: 738

Answers (1)

Rahul
Rahul

Reputation: 77876

Not sure what is @LINE_TERMINATION@ here but change that to

lines terminated by '\n'

(OR)

lines terminated by '\r\n'

Else, out of my guess if @LINE_TERMINATION@ is the string literal for line termination then specify it properly like

lines terminated by '@LINE_TERMINATION@'

Upvotes: 3

Related Questions