Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine current delimiter in MySQL?

Is there a way to determine the current delimiter in MySQL?

The delimiter can be set like this: DELIMITER //

Or like this: \d //

But how do you get the current delimiter?

I tried browsing the results of SHOW STATUS and SHOW VARIABLES to no avail.

like image 346
Leo Avatar asked Dec 26 '14 18:12

Leo


People also ask

What is the delimiter in MySQL?

By default, mysql itself recognizes the semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server. To redefine the mysql delimiter, use the delimiter command.

What is delimiter in database?

In computer programming, a delimiter is a character that identifies the beginning or the end of a character string (a contiguous sequence of characters). The delimiting character is not part of the character string.

What is $$ in MySQL?

In MySQL query, what does the $$ signify? DELIMITER $$ CREATE TRIGGER before_population_update BEFORE UPDATE ON City FOR EACH ROW BEGIN INSERT INTO City_Changes SET ACTION = 'update', CityID = OLD.ID, Population = OLD.

Why do we need delimiter in MySQL?

Delimiters can be used when you need to define the stored procedures, function as well as to create triggers. The default delimiter is semicolon. You can change the delimiters to create procedures and so on.


2 Answers

If you just want to know which delimiter is set right now \s will show you that:

Using delimiter: //

like image 153
Marcel Gwerder Avatar answered Nov 03 '22 16:11

Marcel Gwerder


The delimiter is not a keyword or command on the server (it's not even a reserved keyword), so there is absolutely no way to get it back from the server (since the server doesn't know about it)

It's used by the client (and the client must support it), and only by the client.

If you try to send a DELIMITER // from a client that doesn't support it, you'll get a syntax error

like image 39
Jcl Avatar answered Nov 03 '22 14:11

Jcl