IT分销/经销数据库updateinsert

重复insert,故障。高手处理!

#!/bin/bash
mysql -uroot -pBjxh6yZ masinterfacedb -e "select simmsid from zsl" >1
a=$(awk -F % 'NR==2 {printf $1}' 1)
echo $a
for n in 1 2 3 4 5 ;
do
mysql -uroot -pBjxh6yZ masinterfacedb -e "update zsl set SIMMSID=$((a+$n)),DESTADDR=$(awk -F % 'NR==$n {printf $1}' tele)";
imysql -uroot -pBjxh6yZ masinterfacedb -e "insert into mms_outbox select * from zsl";
done

tele一列电话号码。可读。

执行上述脚本后,报错!

41
ERROR 2013 (HY000): Lost connection to MySQL server during query
22.sh: line 8: imysql: command not found
ERROR 1064 (42000) at line 1: 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 '' at line 1
22.sh: line 8: imysql: command not found
ERROR 1064 (42000) at line 1: 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 '' at line 1
22.sh: line 8: imysql: command not found
ERROR 1064 (42000) at line 1: 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 '' at line 1
22.sh: line 8: imysql: command not found
ERROR 1064 (42000) at line 1: 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 '' at line 1
22.sh: line 8: imysql: command not found
请调手批点
参与9

8同行回答

wangw8451wangw8451软件开发工程师软通动力
不懂MYSQL,进来关注一下,顺便赚一点分好发帖子求助。。。显示全部
不懂MYSQL,进来关注一下,顺便赚一点分好发帖子求助。。。收起
互联网服务 · 2011-11-21
浏览630
kkchatkkchat数据库管理员IBM
不懂Mysql,建议你把“mysql -uroot -pBjxh6yZ masinterfacedb -e”全部改成echo执行,看生成的变量值是否正确,然后对照SQL语法检查。显示全部
不懂Mysql,建议你把“mysql -uroot -pBjxh6yZ masinterfacedb -e”全部改成echo执行,看生成的变量值是否正确,然后对照SQL语法检查。收起
系统集成 · 2011-11-21
浏览632
andychenandychenIT支持东北农业大学
我在写db2的脚本时报db2:command not found 错误时,我就这么处理的,呵呵显示全部
我在写db2的脚本时报db2:command not found 错误时,我就这么处理的,呵呵收起
教育/培训 · 2011-11-20
浏览623
andychenandychenIT支持东北农业大学
语法错误,我对mysql不熟悉,先看有没有imysql命令,如果有,找到mysql的profile文件,在脚本里面加入类似如下的脚本就能用命令了:if [ -f /etc/bashrc ]; then        . /etc/bashrcfi...显示全部
语法错误,我对mysql不熟悉,先看有没有imysql命令,如果有,找到mysql的profile文件,在脚本里面加入类似如下的脚本就能用命令了:
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi收起
教育/培训 · 2011-11-20
浏览660
zss0109211zss0109211数据库管理员null
呵呵,版主。有人来踢馆了显示全部
呵呵,版主。有人来踢馆了收起
互联网服务 · 2011-11-19
浏览633
drdb2drdb2系统工程师se
>> imysql -uroot -pBjxh6yZ masinterfacedb -e "insert into mms_outbox select * from zsl";那来的imysql:@显示全部
>> imysql -uroot -pBjxh6yZ masinterfacedb -e "insert into mms_outbox select * from zsl";
那来的imysql:@收起
互联网服务 · 2011-11-09
浏览635
z13682007z13682007技术主管湖南翎讯
n去掉$报错结果还是一样!显示全部
n去掉$报错结果还是一样!收起
IT分销/经销 · 2011-11-09
浏览623
hongyehongyehongyehongye联盟成员数据库管理员哈尔滨银行
第8行的 imysql应该是输入错误,上面的明显语法有问题~错误信息解释的很明白,你的update 应该把SIMMSID=$((a+$n)),DESTADDR=$(awk -F % 'NR==$n {printf $1}' tele先赋给变量,而不是直接写在语句里,以后这类问题请先自己尝试从错误信息中寻找问题,这样才有助于自己提高...显示全部
第8行的 imysql应该是输入错误,上面的明显语法有问题~错误信息解释的很明白,你的update 应该把
SIMMSID=$((a+$n)),DESTADDR=$(awk -F % 'NR==$n {printf $1}' tele先赋给变量,而不是直接写在语句里,以后这类问题请先自己尝试从错误信息中寻找问题,这样才有助于自己提高收起
银行 · 2011-11-09
浏览614

提问者

z13682007
技术主管湖南翎讯

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2011-11-09
  • 关注会员:1 人
  • 问题浏览:4770
  • 最近回答:2011-11-21
  • X社区推广