Stored Procedure in MYSQL WAMP

Stored Procedure in MYSQL using PHPMYADMIN

Pre-compiled collection of T-SQL statements stored with a name
Written by database developers or DBAs
Used to perform administrative tasks, or apply complex business rules
Contain DML statements

Benefits of Stored Procedures
—————————————-

 

Types of Stored Procedures
————————————-

 

User-defined Stored Examples 

  1. CREATE PROCEDURE getallEmp()
    BEGIN
    SELECT * from emp;
    END

$$ : Delimiter

to execute, use this syntax: call getallEmp()

2) CREATE PROCEDURE InsEmp()
BEGIN
INSERT INTO emp (ename, bs, bn, ta, pf) VALUES
(‘Hari’,12000,2000,200,800);
END

call InsEmp()

3) CREATE PROCEDURE UpEmp()
BEGIN
UPDATE emp set bs=25000 WHERE ename=’Hari’;
END

call UpEmp()

Exit mobile version