
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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)
- Related Questions & Answers
- How to call a stored procedure using select statement in MySQL?
- What is “SELECT TRUE” in MySQL?
- Can we use “IF NOT IN” in a MySQL procedure?
- What does a “set+0” in a MySQL statement do?
- What is “where 1=1” statement in MySQL?
- C++ Program to Print “Even” or “Odd” without using conditional statement
- C Program to print “Even” or “Odd” without using Conditional statement
- What is the usage of “@” symbol in MySQL stored procedure?
- What is the meaning of “SELECT” statement in MySQL and how can it be used?
- MySQL case statement inside a select statement?
- How to set two variables in a stored procedure with a single MySQL select statement?
- Show column value twice in MySQL Select?
- Using combination of “AND” and “OR” in SELECT in ABAP
- Does it make sense to use “LIMIT 1” in a query “SELECT 1 …”?
- HTML5 <input type=“file” accept=“image/*” capture=“camera”> display as image rather than “choose file” button
Advertisements