Mid From PDF SQL SQL & Databases

How do you pass parameters to stored procedures? Stored procedures allow you to pass parameters to them, either input or output parameters. ● Input Parameters: These allow you to send data to the procedure. ● Output Parameters: These allow the procedure to send data back to the caller. Example: SQL Server: CREATE PROCEDURE GetEmployeeSalary (@emp_id INT)

BEGIN

SELECT salary FROM employees WHERE id = @emp_id;

END;

  • Calling the procedure:
EXEC GetEmployeeSalary @emp_id = 101;
  • MySQL:

DELIMITER //

CREATE PROCEDURE GetEmployeeSalary(IN emp_id INT)

BEGIN

SELECT salary FROM employees WHERE id = emp_id;

END //

DELIMITER ;

  • Calling the procedure:

CALL GetEmployeeSalary(101);

More from SQL Server Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details