我没有得到我的语法错误,MySql说未知的系统可以完成:分隔符|
CREATE PROCEDURE UPDATELOMON ()
BEGIN
DECLARE First_cur CURSOR FOR SELECT oraginal_level,level FROM LOMTEMP;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE;
OPEN First_cur;
FirstLoop: LOOP
FETCH First_cur INTO oraginal,toupdate;
IF done THEN
LEAVE FirstLoop;
END IF;
CALL updt(oraginal,toupdate);
END LOOP FirstLoop;
CLOSE First_cur;
END;
答案 0 :(得分:1)
创建STORED PROCEDURE时需要更改分隔符:
DELIMITER $$
DROP PROCEDURE IF EXISTS UPDATELOMON$$
CREATE PROCEDURE UPDATELOMON ()
BEGIN
DECLARE First_cur CURSOR FOR SELECT oraginal_level,level FROM LOMTEMP;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE;
OPEN First_cur;
FirstLoop: LOOP
FETCH First_cur INTO oraginal,toupdate;
IF done THEN
LEAVE FirstLoop;
END IF;
CALL updt(oraginal,toupdate);
END LOOP FirstLoop;
CLOSE First_cur;
END$$
DELIMITER ;
默认情况下,MySQL本身将分号识别为语句分隔符,因此必须临时重新定义分隔符以使MySQL将整个存储的程序定义传递给服务器。否则,MySQL会在它到达END语句之前打破CREATE PROCEDURE(在第一个分号上,在你的情况下,在CONTINUE HANDLER语句之前)。
您可以查看文档了解更多详情: http://dev.mysql.com/doc/refman/5.5/en/stored-programs-defining.html
答案 1 :(得分:0)
关于@ Zagor23的回答。您可以在$$
行删除DROP PROCEDURE...
,然后在DELIMITER $$
后面添加DROP PROCEDURE IF EXISTS UPDATELOMON;
DELIMITER $$
。所以你将拥有以下内容:
//
// ViewController.swift
// MyCalculator
//
// Created by Kevin Maldjian on 2/6/17.
// Copyright © 2017 Kevin Maldjian. All rights reserved.
//
import UIKit
import Foundation
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBOutlet weak var LBLOutput: UILabel!
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func btrNumberClick(_ sender: UIButton) {
let cb = calculatorBrain(LBLOutput: LBLOutput , sender: sender)
cb.btrNumberClick()
}
@IBAction func clearTheLabel(_ sender: Any) {
let cb = calculatorBrain(LBLOutput: LBLOutput, sender: sender as! UIButton)
cb.clearTheLabel()
}
@IBAction func goNegative(_ sender: Any){
let cb = calculatorBrain(LBLOutput: LBLOutput, sender: sender as! UIButton)
cb.goNegative()
}
@IBAction func squareRoot(_ sender: Any) {
let cb = calculatorBrain(LBLOutput: LBLOutput, sender: sender as! UIButton)
cb.squareRoot()
}
}