我们如何编写MySQL存储过程以从表中选择所有数据?
为了证明这一点,我们创建了一个名为“selectdetails()”的过程,该过程将从表“student_detail”中获取所有记录。
mysql> Delimiter // mysql> Create Procedure selectdetails() -> BEGIN -> Select * from student_detail; -> END//
现在,在调用此过程之后,我们将从'student_detail'表中获取所有记录。
mysql> Delimiter ; mysql> CALL selectdetails(); +-----------+-------------+------------+ | Studentid | StudentName | address | +-----------+-------------+------------+ | 100 | Gaurav | Delhi | | 101 | Raman | Shimla | | 103 | Rahul | Jaipur | | 104 | Ram | Chandigarh | | 105 | Mohan | Chandigarh | +-----------+-------------+------------+ 5 rows in set (0.00 sec)