Skip to content

Commit 52bb942

Browse files
authored
Update Readme.md
1 parent 39b3695 commit 52bb942

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Chapter 10/Readme.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Below are some benefits of Stored Procedure:
189189

190190
There are two options to choose the default database before performing any SQL operation:
191191
1. Right click on database and click on "Set as Default Schema"
192-
2. ***USE*** along with database name can be used to set the default database before any SQL statements run. Below is the syntax to use it:
192+
2. ***USE***: USE keyword along with database name can be used to set the default database before any SQL statements run. Below is the syntax to use it:
193193

194194
**Syntax:**
195195

@@ -205,6 +205,29 @@ USE sakila;
205205
SELECT * FROM film_text;
206206
```
207207

208+
### Changing Delimiter
209+
210+
The default delimiter in almost all of the SQL flavours including MySQL is semicolon(;). Although this can be changed to another character e.g., // or $$.
211+
212+
There are few cases where changing delimeter is required specially in Stored Procedures which consists of multiple statements separated by a semicolon (;). If you use a MySQL client program(MySQL Workbench) to define a stored procedure that contains semicolon characters, MySQL Workbench will not treat the whole stored procedure as a single statement, but many statements.
213+
214+
Therefore, you must redefine the delimiter temporarily so that you can pass the whole stored procedure to the server as a single statement.
215+
216+
The delimiter_character may consist of a single character or multiple characters e.g., // or $$. However, you should avoid using the backslash (\) because it’s the escape character in MySQL.
217+
218+
**Syntax:**
219+
```sql
220+
DELIMITER delimiter_character
221+
```
222+
223+
**Example:**
224+
```sql
225+
DELIMITER //
226+
```
227+
228+
229+
230+
208231

209232

210233

0 commit comments

Comments
 (0)