如何在mariadb中查询数据时包含两个SET语句

时间:2022-06-01 13:00:48

Database - Mariadb, Platform - Linux

数据库 - Mariadb,平台 - Linux

Below code gives error : ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Set ENDTIME = STR_TO_DATE (@T2, '%m%d%Y%H%i%s')' at line 6.

下面的代码给出了错误:ERROR 1064(42000):您的SQL语法有错误;检查与您的MariaDB服务器版本对应的手册,以便在第6行的“设置ENDTIME = STR_TO_DATE(@ T2,'%m%d%Y%H%i%s')'附近使用正确的语法。

   1 LOAD DATA LOCAL 
   2 INFILE '/home/test.txt' 
   3 INTO TABLE cdr FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
   4 (ID , APARTY , BPARTY , @T1, @T2, DURATION, INTG, OUTTG, INRC, OUTRC)
   5 Set STARTTIME = STR_TO_DATE (@T1, '%m%d%Y%H%i%s'),
   6 Set ENDTIME = STR_TO_DATE (@T2, '%m%d%Y%H%i%s');

Guessing the end of line 5 has some problem with comma. I am not sure how to include both the SET statements at a time.If i delete line 6, the code works fine.

猜测第5行的结尾有逗号的问题。我不知道如何一次包含两个SET语句。如果我删除第6行,代码工作正常。

1 个解决方案

#1


0  

You don't need to repeat the set keyword.

您无需重复set关键字。

Set X = '', Y = '';

设置X ='',Y ='';

#1


0  

You don't need to repeat the set keyword.

您无需重复set关键字。

Set X = '', Y = '';

设置X ='',Y ='';