String createProSql= "use quickstart\n"+
    "DELIMITER $$\n"+
  //"DROP PROCEDURE IF EXISTS findName $$\n"+
   "CREATE PROCEDURE findName (inout name char(200),age int)\n"+
    "BEGIN \n"+
   "select username into name from user1 where userage=age;\n"+
   "END $$\n"+
   "DELIMITER ;";
 sm.executeUpdate(createProSql);
总是执行错误:
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 'DELIMITER $$
CREATE PROCEDURE findName (inout name char(200),age int)
BEGIN 
sel' at line 2我怀疑是findname的错误,但是用引号括起来还是不行
请高手指教

解决方案 »

  1.   

    上面格式不清楚,重新发下String createProSql= "use quickstart\n"+     "DELIMITER $$\n"+   //"DROP PROCEDURE IF EXISTS findName $$\n"+   "CREATE PROCEDURE findName (inout name char(200),age int)\n"+         "BEGIN \n"+    "select username into name from user1 where userage=age;\n"+  "END $$\n"+    "DELIMITER ;";
     sm.executeUpdate(createProSql);
    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 'DELIMITER $$
    CREATE PROCEDURE findName (inout name char(200),age int)
    BEGIN 
    sel' at line 2
      

  2.   

    这样用太长了,很容易出错,你用String.format 好好 规范一下,我以前这样用总出问题 规范一下,再试试,这样用也不容易看