• 存储过程


    # ----   无参存储过程  ------------
    DELIMITER $$
    CREATE PROCEDURE pro_insert_employees()
        BEGIN
            insert into employees (first_name,last_name) VALUES("1","1"),("2","2"),("3","3");
        END $$
    DELIMITER ;    
        
    CALL pro_insert_employees() ;
    
    #
    ---- in 存储过程 ---------- DELIMITER $$ CREATE PROCEDURE pro_findEmployeesByid(IN id INT) BEGIN SELECT * FROM employees WHERE employee_id=id; END $$ DELIMITER ; CALL pro_findEmployeesByid(101);
    #
    ----- OUT 存储过程 ----------- DELIMITER $$ CREATE PROCEDURE pro_countEmployees(OUT sumCount INT) BEGIN SELECT COUNT(1) INTO sumCount FROM employees; END $$ DELIMITER ; CALL pro_countEmployees(@sumCount); SELECT @sumCount;
    #
    ----- INOUT 存储过程 ---------------- DELIMITER $$ CREATE PROCEDURE pro_countByDepartmentId(IN departId INT ,OUT sumCount INT ) BEGIN SELECT COUNT(1) INTO sumCount FROM employees WHERE department_id=departId; END $$ DELIMITER ; CALL pro_countByDepartmentId(90,@sumCount); SELECT @sumCount;
  • 相关阅读:
    同余 扩展欧几里得
    185. [USACO Oct08] 挖水井
    Dijkstra算法
    Floyed算法
    codves——1079 回家
    codves——1021 玛丽卡
    codves——5960 信使
    计算几何基础
    【正睿oi省选十连测】第一场
    [APIO2012]守卫
  • 原文地址:https://www.cnblogs.com/draymond/p/12641496.html
Copyright © 2020-2023  润新知