[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Delimiter is set to $$ so that you can use

I read as floows about Delimitter and not clear on it

Creating Stored Procedure
/* Delimiter is set to $$ so that you can use ;
* inside body of the procedure.
/* Create a stored procedure */
CREATE PROCEDURE create_school_table()
CREATE TABLE school_table (
school_id INT NOT NULL,
school_name VARCHAR(45) NOT NULL,
PRIMARY KEY (school_id)
END $$
/* Change the

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
1 Solution
The default delimiter is a semi-colon ; ... as you have used the semi-colon to complete the create table statement, it would normally be interpreted as the end of the statement and the compiler would error as the create procedure is not complete.
By changing the delimiter, the entire create procedure down to the END is seen as one statement and will compile.

By Changing The Delimiter We Can Issue The Multiple SQL Statments Together.

Otherwise It will Give An Error Or Execution Of Multiple Statments Will Be Interrupted While ; Encounters As It Is The Default Delimiter Used.

So Changing The Delimiter To $$ Makes The Server Think Multiple Statments As Single Statment only..

Hope This would Help.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now