Quantcast
Channel: Статьи
Viewing all articles
Browse latest Browse all 18

Use of a DELIMITER in MySQL

$
0
0

delimiter mysql

Depending on the nature of the script, you may need control of the delimiter used to separate the statements that will make up a script. The most common example of this is where you have a multi-statement stored routine as part of your script. In this case if the default delimiter of ; is used you will get an error when you attempt to execute the script.

 

The DELIMITER command is used to change the standard delimiter of MySQL commands. The standard command delimiter is the ';' character that defines the end of the query.

Script for example:

INSERT INTO actor VALUES (1, 'PENELOPE', 'GUINESS', '2006-02-15 04:34:33');
INSERT INTO actor VALUES (2, 'NICK', 'WAHLBERG', '2006-02-15 04:34:33');
INSERT INTO actor VALUES (3, 'ED', 'CHASE', '2006-02-15 04:34:33');
INSERT INTO actor VALUES (4, 'JENNIFER', 'DAVIS', '2006-02-15 04:34:33');
INSERT INTO actor VALUES (5, 'JOHNNY', 'LOLLOBRIGIDA', '2006-02-15 04:34:33');

 

Now let’s have a look at the following script. It consists of several INSERT queries, procedure creating and several more INSERT queries.


Viewing all articles
Browse latest Browse all 18

Trending Articles