Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I facing the issue in executing a SQL Stored Procedure and I got the error message as showing syntax error in my statement, but I couldn't find that,

Stored Procedure


-- Routine DDL -- Note: comments before and after the routine body will not be stored by the server


DELIMITER $$

CREATE PROCEDURE enterprisedb.orderstatus

( IN inmode varchar(27), IN OrderStatus_id int, IN Status_comments varchar(255), IN CreatedOn datetime, IN CreatedBy varchar(255), IN UpdatedOn datetime, IN UpdatedBy varchar(255), IN is_active bit )

BEGIN

/*insert*/ if inmode = 'insert' then insert into orderstatus (OrderStatus_id, OrderStatus, Status_comments, CreatedOn, CreatedBy, UpdatedOn, UpdatedBy, is_active) values (OrderStatus_id, OrderStatus, Status_comments, CreatedOn, CreatedBy, UpdatedOn, UpdatedBy, is_active); end if; /*update*/ if inmode = 'update' then update orderstatus ods set ods.OrderStatus = OrderStatus, ods.Status_comments = Status_comments, ods.CreatedOn = CreatedOn, ods.CreatedBy = CreatedBy, ods.UpdatedOn = UpdatedOn, ods.UpdatedBy = UpdatedBy, ods.is_active = is_active where ods.OrderStatus_id = OrderStatus_id; /*delete*/ if inmode = 'delete' then update orderstatus ods set ods.is_active = 0 where ods.OrderStatu_id = OrderStatus_id; end if; /*select*/ if inmode = 'select' then select * from orderstatus ods where ods.OrderStatus_id = OrderStatus_id; end if; END

It displays the following messages,I couldn't find the error.

enter image description here

  1. Can I click on the Yes button and continue with procedure?
  2. Will it cause any issue?
  3. How to solve this? a A Any suggestions, answers and comments are welcome.

Thanks in advance.

share|improve this question

closed as off-topic by dezso, StanleyJohns, RolandoMySQLDBA, Jon Seigel, Mark Storey-Smith Jul 19 '13 at 16:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – dezso, StanleyJohns, RolandoMySQLDBA, Jon Seigel, Mark Storey-Smith
If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer 1

up vote 0 down vote accepted

Are you perhaps missing an "end if;" from the "if inmode = 'delete'" statement?

share|improve this answer
    
thanks for the answer, I found that, now it is working. –  rathishDBA Jul 19 '13 at 10:08
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.