日期:2014-05-16  浏览次数:20838 次

SQL批处理运行错误,知道的帮忙下!
INSERT   INTO   e_deal   (joint,company_joint,year,sale,asset,earn)   select   '91 ', '4806
,2005, ' ', ' ', ' '   from   organization   t   where   t.id= '4806 ';INSERT   INTO   e_deal   (joint,
ompany_joint,year,sale,asset,earn)select   '90 ', '4806 ',2006,t.sale,t.asset,t.taxp
  from   organization   t   where   t.id= '4806 ';INSERT   INTO   e_deal   (joint,company_joint,
ear,sale,asset,earn)   select   '89 ', '4806 ',2007, ' ', ' ', ' '   from   organization   t   where
t.id= '4806 '
java.sql.BatchUpdateException:   You   have   an   error   in   your   SQL   syntax;   check   the
anual   that   corresponds   to   your   MySQL   server   version   for   the   right   syntax   to   use
near   ' ' '   from   organization   t   where   t.id= '4806 ' '   at   line   1
                at   com.mysql.jdbc.Statement.executeBatch(Statement.java:1086)

------解决方案--------------------
t.id= '4806 ' 是不是应该是 t.id=4806
------解决方案--------------------
t.id= '4806 ' 不会报告错误。
------解决方案--------------------
INSERT INTO e_deal (joint,company_joint,year,sale,asset,earn) select '91 ', '4806 ', '2005 ', ' ', ' ', ' ' from organization t where t.id= '4806 ';

INSERT INTO e_deal (joint,ompany_joint,year,sale,asset,earn) select '90 ', '4806 ',2006,t.sale,t.asset,t.taxp from organization t where t.id= '4806 ';

INSERT INTO e_deal (joint,company_joint,ear,sale,asset,earn) select '89 ', '4806 ',2007, ' ', ' ', ' ' from organization t where t.id= '4806 ';

修正了几处语法错误,楼主试验一下。