Defining delimiters in mysql [duplicate]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1
















This question already has an answer here:




  • syntax error: 'delimiter ' is not valid input here

    2 answers




I am having trouble with creating a stored procedure in mySQL. I think the issue is that it is seeing my delimiter as a string, but I may be wrong. Here is my code:



DELIMITER //
CREATE PROCEDURE getOrderInfo (IN whichorderID int)
BEGIN
SELECT hslineitem.orderId, hsorders.orderdate, hslineitem.partNum, hslineitem.numOrdered,
hslineitem.price
FROM hslineitem, hsorders
WHERE hslineitem.orderId = hsorders.orderId
AND orderID = whichorderID ;
END
//
DELIMITER;


errormessage



So, is there a specific way I need to identify that it is a delimiter and not a string? I have been looking at other examples online and it doesn't seem that they do anything differently. Thanks in advance!










share|improve this question















marked as duplicate by Alex, Joe Stefanelli mysql
Users with the  mysql badge can single-handedly close mysql questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 22:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

    – Dark Falcon
    Nov 21 '18 at 21:58











  • just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

    – Alex
    Nov 21 '18 at 22:00













  • $$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

    – Shawn Benson
    Nov 21 '18 at 22:06











  • Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

    – Shawn Benson
    Nov 21 '18 at 22:06






  • 1





    Is it possibly just a missing space between "DELIMITER" and the last semicolon?

    – Kaii
    Nov 21 '18 at 22:08




















1
















This question already has an answer here:




  • syntax error: 'delimiter ' is not valid input here

    2 answers




I am having trouble with creating a stored procedure in mySQL. I think the issue is that it is seeing my delimiter as a string, but I may be wrong. Here is my code:



DELIMITER //
CREATE PROCEDURE getOrderInfo (IN whichorderID int)
BEGIN
SELECT hslineitem.orderId, hsorders.orderdate, hslineitem.partNum, hslineitem.numOrdered,
hslineitem.price
FROM hslineitem, hsorders
WHERE hslineitem.orderId = hsorders.orderId
AND orderID = whichorderID ;
END
//
DELIMITER;


errormessage



So, is there a specific way I need to identify that it is a delimiter and not a string? I have been looking at other examples online and it doesn't seem that they do anything differently. Thanks in advance!










share|improve this question















marked as duplicate by Alex, Joe Stefanelli mysql
Users with the  mysql badge can single-handedly close mysql questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 22:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

    – Dark Falcon
    Nov 21 '18 at 21:58











  • just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

    – Alex
    Nov 21 '18 at 22:00













  • $$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

    – Shawn Benson
    Nov 21 '18 at 22:06











  • Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

    – Shawn Benson
    Nov 21 '18 at 22:06






  • 1





    Is it possibly just a missing space between "DELIMITER" and the last semicolon?

    – Kaii
    Nov 21 '18 at 22:08
















1












1








1









This question already has an answer here:




  • syntax error: 'delimiter ' is not valid input here

    2 answers




I am having trouble with creating a stored procedure in mySQL. I think the issue is that it is seeing my delimiter as a string, but I may be wrong. Here is my code:



DELIMITER //
CREATE PROCEDURE getOrderInfo (IN whichorderID int)
BEGIN
SELECT hslineitem.orderId, hsorders.orderdate, hslineitem.partNum, hslineitem.numOrdered,
hslineitem.price
FROM hslineitem, hsorders
WHERE hslineitem.orderId = hsorders.orderId
AND orderID = whichorderID ;
END
//
DELIMITER;


errormessage



So, is there a specific way I need to identify that it is a delimiter and not a string? I have been looking at other examples online and it doesn't seem that they do anything differently. Thanks in advance!










share|improve this question

















This question already has an answer here:




  • syntax error: 'delimiter ' is not valid input here

    2 answers




I am having trouble with creating a stored procedure in mySQL. I think the issue is that it is seeing my delimiter as a string, but I may be wrong. Here is my code:



DELIMITER //
CREATE PROCEDURE getOrderInfo (IN whichorderID int)
BEGIN
SELECT hslineitem.orderId, hsorders.orderdate, hslineitem.partNum, hslineitem.numOrdered,
hslineitem.price
FROM hslineitem, hsorders
WHERE hslineitem.orderId = hsorders.orderId
AND orderID = whichorderID ;
END
//
DELIMITER;


errormessage



So, is there a specific way I need to identify that it is a delimiter and not a string? I have been looking at other examples online and it doesn't seem that they do anything differently. Thanks in advance!





This question already has an answer here:




  • syntax error: 'delimiter ' is not valid input here

    2 answers








mysql delimiter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 22:06









Joe Stefanelli

112k14193209




112k14193209










asked Nov 21 '18 at 21:47









Shawn BensonShawn Benson

415




415




marked as duplicate by Alex, Joe Stefanelli mysql
Users with the  mysql badge can single-handedly close mysql questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 22:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Alex, Joe Stefanelli mysql
Users with the  mysql badge can single-handedly close mysql questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 22:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

    – Dark Falcon
    Nov 21 '18 at 21:58











  • just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

    – Alex
    Nov 21 '18 at 22:00













  • $$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

    – Shawn Benson
    Nov 21 '18 at 22:06











  • Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

    – Shawn Benson
    Nov 21 '18 at 22:06






  • 1





    Is it possibly just a missing space between "DELIMITER" and the last semicolon?

    – Kaii
    Nov 21 '18 at 22:08
















  • 1





    1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

    – Dark Falcon
    Nov 21 '18 at 21:58











  • just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

    – Alex
    Nov 21 '18 at 22:00













  • $$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

    – Shawn Benson
    Nov 21 '18 at 22:06











  • Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

    – Shawn Benson
    Nov 21 '18 at 22:06






  • 1





    Is it possibly just a missing space between "DELIMITER" and the last semicolon?

    – Kaii
    Nov 21 '18 at 22:08










1




1





1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

– Dark Falcon
Nov 21 '18 at 21:58





1. How are you running this query? 2. Why did you choose //? Did you try something else, such as $$?

– Dark Falcon
Nov 21 '18 at 21:58













just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

– Alex
Nov 21 '18 at 22:00







just switch delimiter back to what it was before ;-) . :-) END // DELIMITER ;

– Alex
Nov 21 '18 at 22:00















$$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

– Shawn Benson
Nov 21 '18 at 22:06





$$ did not work either. Those were the only two examples provided to me by my book, and also the only two I found online.

– Shawn Benson
Nov 21 '18 at 22:06













Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

– Shawn Benson
Nov 21 '18 at 22:06





Alex, could you elaborate further on what you mean by what it was before? I'm not sure I understand.

– Shawn Benson
Nov 21 '18 at 22:06




1




1





Is it possibly just a missing space between "DELIMITER" and the last semicolon?

– Kaii
Nov 21 '18 at 22:08







Is it possibly just a missing space between "DELIMITER" and the last semicolon?

– Kaii
Nov 21 '18 at 22:08














1 Answer
1






active

oldest

votes


















0














You statement is missing a space before the last semicolon, because the semicolon in this case is really a parameter for the DELIMITER command.



Only after resetting the delimiter back to semicolon it can be used normally:



DELIMITER //
CREATE PROCEDURE getOrderInfo (IN whichID int)
BEGIN
SELECT *
FROM orders
WHERE id = whichID; -- this semicolon is interpreted as text
END//
DELIMITER ; -- space is needed here!
SELECT 1 FROM dual; -- but not here.





share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You statement is missing a space before the last semicolon, because the semicolon in this case is really a parameter for the DELIMITER command.



    Only after resetting the delimiter back to semicolon it can be used normally:



    DELIMITER //
    CREATE PROCEDURE getOrderInfo (IN whichID int)
    BEGIN
    SELECT *
    FROM orders
    WHERE id = whichID; -- this semicolon is interpreted as text
    END//
    DELIMITER ; -- space is needed here!
    SELECT 1 FROM dual; -- but not here.





    share|improve this answer






























      0














      You statement is missing a space before the last semicolon, because the semicolon in this case is really a parameter for the DELIMITER command.



      Only after resetting the delimiter back to semicolon it can be used normally:



      DELIMITER //
      CREATE PROCEDURE getOrderInfo (IN whichID int)
      BEGIN
      SELECT *
      FROM orders
      WHERE id = whichID; -- this semicolon is interpreted as text
      END//
      DELIMITER ; -- space is needed here!
      SELECT 1 FROM dual; -- but not here.





      share|improve this answer




























        0












        0








        0







        You statement is missing a space before the last semicolon, because the semicolon in this case is really a parameter for the DELIMITER command.



        Only after resetting the delimiter back to semicolon it can be used normally:



        DELIMITER //
        CREATE PROCEDURE getOrderInfo (IN whichID int)
        BEGIN
        SELECT *
        FROM orders
        WHERE id = whichID; -- this semicolon is interpreted as text
        END//
        DELIMITER ; -- space is needed here!
        SELECT 1 FROM dual; -- but not here.





        share|improve this answer















        You statement is missing a space before the last semicolon, because the semicolon in this case is really a parameter for the DELIMITER command.



        Only after resetting the delimiter back to semicolon it can be used normally:



        DELIMITER //
        CREATE PROCEDURE getOrderInfo (IN whichID int)
        BEGIN
        SELECT *
        FROM orders
        WHERE id = whichID; -- this semicolon is interpreted as text
        END//
        DELIMITER ; -- space is needed here!
        SELECT 1 FROM dual; -- but not here.






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 21 '18 at 22:21

























        answered Nov 21 '18 at 22:11









        KaiiKaii

        15.6k22850




        15.6k22850

















            Popular posts from this blog

            How to pass form data using jquery Ajax to insert data in database?

            National Museum of Racing and Hall of Fame

            Guess what letter conforming each word