CREATE TABLE Employee (
E_id INT PRIMARY KEY,
E_name VARCHAR(255),
Age INT,
Salary DECIMAL(10, 2)
);
INSERT INTO Employee (E_id, E_name, Age, Salary) VALUES (1, 'John Doe',
30, 50000.00);
INSERT INTO Employee (E_id, E_name, Age, Salary) VALUES (2, 'Jane Smith',
25, 60000.00);
INSERT INTO Employee (E_id, E_name, Age, Salary) VALUES (3, 'Alice
Johnson', 35, 70000.00);
DELIMITER //
CREATE PROCEDURE extract_employee_values()
BEGIN
DECLARE done BOOLEAN DEFAULT FALSE;
DECLARE emp_id INT;
DECLARE emp_name VARCHAR(255);
DECLARE emp_age INT;
DECLARE emp_salary DECIMAL(10, 2);
DECLARE cur CURSOR FOR
SELECT E_id, E_name, Age, Salary FROM Employee;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur;
emp_loop: LOOP
FETCH cur INTO emp_id, emp_name, emp_age, emp_salary;
IF done THEN
LEAVE emp_loop;
END IF;
-- Do something with the extracted values
-- For example, you can print them
SELECT emp_id, emp_name, emp_age, emp_salary;
END LOOP;
CLOSE cur;
END //
DELIMITER ;
CALL extract_employee_values();
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}