
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we create MySQL stored procedures without ‘BEGIN’ and ‘END’?
We can create MySQL stored procedures without ‘BEGIN’ and ‘END’ just in the same way created with both of them only thing is to omit to BEGIN and END. In the following example, we are creating a stored procedure without ‘BEGIN’ and ‘END’ to get all the rows from a table −
Example
mysql> Delimiter // mysql> CREATE PROCEDURE Hello() -> SELECT * from Student_info; // Query OK, 0 rows affected (0.08 sec)
We can see MySQL created stored procedures without BEGIN and END. Now invoke this by CALL statement −
mysql> Delimiter ; mysql> CALL Hello(); +-----+---------+------------+------------+ | id | Name | Address | Subject | +-----+---------+------------+------------+ | 101 | YashPal | Amritsar | History | | 105 | Gaurav | Chandigarh | Literature | | 125 | Raman | Shimla | Computers | +------+---------+------------+------------+ 3 rows in set (0.18 sec) Query OK, 0 rows affected (0.28 sec)
- Related Articles
- What is stored procedure and how can we create MySQL stored procedures?
- How can we access tables through MySQL stored procedures?
- How can we see the list of stored procedures and stored functions in a particular MySQL database?
- Create a stored Procedures using MySQL Workbench?
- How can we grant a user to access all stored procedures in MySQL?
- What are MySQL stored functions and how can we create them?
- How can we see only the list of stored procedures in a particular MySQL database?
- How can we see the list, along with other information, stored procedures in a particular MySQL database?
- How can we create MySQL views without any column list?
- How can we create MySQL stored procedure to calculate the factorial?
- How can we see the list, along with complete information, of stored procedures in a particular MySQL database?
- Use delimiter correctly in a MySQL stored procedure to avoid BEGIN/END statements errors
- How can we invoke MySQL stored procedure?
- What are stored procedures? How to call stored procedures using JDBC program?
- How can we alter a MySQL stored procedure?

Advertisements