Delimiter is set to $$ so that you can use

Posted on 2012-09-20
Last Modified: 2012-10-01
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
Question by:gudii9
    LVL 25

    Expert Comment

    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.
    LVL 2

    Accepted Solution


    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now