使用存储过程插入值的语法错误

时间:2014-09-28 01:45:58

标签: mysql stored-procedures mysql-workbench

create procedure sp_FldBkgData
(
    IN awb int,
    IN origin varchar(2),
    IN dist varchar(2),
    IN courier int,
    IN pdate varchar(10),
    IN acc int,
    IN service varchar(1),
    IN agent1 varchar(5),
    IN agent2 varchar(5),
    IN bkgtime int,
    IN sname varchar(45),
    IN sadd1 varchar(45),
    IN sadd2 varchar(45),
    IN sadd3 varchar(45),
    IN scity varchar(45),
    IN sstate varchar(25),
    IN spostal int,
    IN scountry varchar(8),
    IN sph varchar(11),
    IN sfax varchar(25),
    IN smail varchar(45),
    IN sref varchar(45),
    IN carrier varchar(45),
    IN ccompany varchar(45),
    IN cname varchar(45),
    IN cadd1 varchar(45),
    IN cadd2 varchar(45),
    IN cadd3 varchar(45),
    IN ccity varchar(25),
    IN cstate varchar(15),
    IN ccountry varchar(45),
    IN cgateway varchar(3),
    IN cph varchar(25),
    IN goods varchar(45),
    IN paymode varchar(7),
    IN curr varchar(3),
    IN val int,
    IN pcs int,
    IN weight double,
    IN handling varchar(1),
    IN insurrance varchar(3),
    IN fac int,
    IN gst int
)
BEGIN
INSERT INTO cms_module_fieldbooking (Awb) VALUES (awb);
END

这是错误: enter image description here

1 个答案:

答案 0 :(得分:1)

要在MySQL Workbench查询编辑器中创建过程,您需要指定分号以外的分隔符。

例如:

  DELIMITER $$

  CREATE PROCEDURE foo() 
  BEGIN
     SELECT 'foo';
  END$$

  DELIMITER ;

作为替代方案,MySQL Workbench还有一个"例程"编辑器,自动为您处理分隔符。 (在左侧的模式列表中,右键单击“过程”,然后选择“#34;创建过程"”。单击“应用”后,您将看到包含DELIMITER语句的实际脚本。