
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL Procedure to Display a Select Statement Twice
To understand, let us create a stored procedure. Here, we have 2 select statements in the stored procedure −
mysql> DELIMITER // mysql> CREATE PROCEDURE select_statement() -> BEGIN -> SELECT "HI" AS `FIRST VALUE`; -> SELECT "HELLO" AS `SECOND VALUE`; -> END -> // Query OK, 0 rows affected (0.09 sec) mysql> DELIMITER ;
Call the stored procedure using CALL command −
mysql> CALL select_statement();
This will produce the following output −
+-------------+ | FIRST VALUE | +-------------+ | HI | +-------------+ 1 row in set (0.00 sec) +--------------+ | SECOND VALUE | +--------------+ | HELLO | +--------------+ 1 row in set (0.01 sec) Query OK, 0 rows affected (0.01 sec)
Advertisements