/添加存储过程/
DROP PROCEDURE IF EXISTS Add_address;
CREATE PROCEDURE Add_address(_AName VARCHAR(50),_Pid int)
BEGIN
insert into Address values(0,_AName,_Pid);
END;
CALL Add_address(‘锦州市’,3)
/显示存储过程/
DROP PROCEDURE IF EXISTS Show_address;
CREATE PROCEDURE Show_address()
BEGIN
SELECT * FROM Address;
END;
CALL Show_address
/删除存储过程/
DROP PROCEDURE IF EXISTS Del_address;
CREATE PROCEDURE Del_address(_Id int)
BEGIN
DELETE from Address WHERE Id = _Id;
END;
CALL Del_address(18);
/反填存储过程/
DROP PROCEDURE IF EXISTS Back_address;
CREATE PROCEDURE Back_address(_Id int)
BEGIN
SELECT * FROM Address where Id = _Id;
END;
CALL Back_address(7);
/修改存储过程/
DROP PROCEDURE IF EXISTS Edit_address;
CREATE PROCEDURE Edit_address(_Id int,_AName VARCHAR(50))
BEGIN
UPDATE Address set AName = _AName WHERE Id = _Id;
END;
CALL Edit_address(7,‘奉贤区’);
本文链接:https://my.lmcjl.com/post/12651.html
4 评论