我希望我的函数在函数参数
中放入“INC”时返回“INC”
SELECT getEquivalentGrade('INC');
输出:INC
DELIMITER $$
USE `nmsc_scholarship_db`$$
DROP FUNCTION IF EXISTS `getEquivalentGrade`$$
CREATE DEFINER =`root`@`localhost` FUNCTION `getEquivalentGrade`(grade CHAR(5))
RETURNS CHAR(5)
CHARSET latin1
BEGIN
DECLARE equivalent_grade CHAR(5);
IF (grade > 100)
THEN
SET equivalent_grade = '1';
ELSEIF (grade < 69)
THEN
SET equivalent_grade = '5';
ELSEIF (grade = 'INC')
THEN
SET equivalent_grade = grade;
ELSE
SET equivalent_grade = (SELECT equivalent_grade.`equivgrade`
FROM equivalent_grade
WHERE equivalent_grade.`fromgrade` <= grade AND equivalent_grade.`tograde` >= grade);
END IF;
RETURN equivalent_grade;
END$$
DELIMITER ;
现在,如果我将执行此功能,这就是我得到的。
SELECT getEquivalentGrade('INC');
输出:5
答案 0 :(得分:0)
您应该将INC移至TOP
public class Login extends Main{
public void login() throws IOException{
File src = new File("F:\\selenium\\AutomationData.xlsx");
FileInputStream fin = new FileInputStream(src);
XSSFWorkbook wbook = new XSSFWorkbook(fin);
XSSFSheet sheet = wbook.getSheetAt(0);
WebElement username =driver.findElement(By.id("ei-login-Username"));
username.sendKeys("12365478");
WebElement next =driver.findElement(By.id("btnSubmit"));
next.click();
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
WebElement pin =driver.findElement(By.id("ei-login-Pin"));
pin.sendKeys("971997");
WebElement login =driver.findElement(By.id("btnPinSubmit"));
login.click();
}
你应该研究IFELSE是如何运作的。 条件工作就像它会停止/转到ENDIF ..如果**条件真正符合,或者他们会一直找到最新 IF