Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4066874
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:10:50+00:00 2026-05-20T16:10:50+00:00

I wrote a stored procedure that worked in my local machine but in the

  • 0

I wrote a stored procedure that worked in my local machine but in the server, it wont execute! It would be great to have help

The stored procedure is

DROP PROCEDURE `ASKUS_INSERT`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `ASKUS_INSERT`(
 SENDERCONSUMERID INT(11),
 QUESTION_POSTED TEXT,
 DESCRIPTION_POSTED TEXT,
 NETWORK_ID INT(11),
 COMMTYPEID INT(11),
 CONSUMERID INT(11),
 CATEGORY_ID INT(11),
 ACTIONID INT(11),
 QUESTION_SLUG TEXT
)
BEGIN
     DECLARE LASTINSERTEDID INT DEFAULT 0;
     DECLARE GETTIPSAMOUNT INT DEFAULT 0;
     DECLARE GETTIPSAMOUNTCONSUMER INT DEFAULT 0;
     DECLARE SETTIPSAMOUNTCONSUMER INT DEFAULT 0;
     DECLARE CHECKCOUNTTIPSEXIST INT DEFAULT 0;

     SELECT COUNT(*) INTO CHECKCOUNTTIPSEXIST FROM ACTION_ENTERPRISE_MAPPING WHERE ACTION_ID = ACTIONID;
     IF CHECKCOUNTTIPSEXIST  > 0 THEN
        SELECT SUM(TIP_AMOUNT) INTO GETTIPSAMOUNT FROM ACTION_ENTERPRISE_MAPPING WHERE ACTION_ID = ACTIONID;
     ELSE
         SET GETTIPSAMOUNT  = 0;
     END IF;     


     SELECT CONSUMER_TIPS INTO GETTIPSAMOUNTCONSUMER FROM CONSUMER_PROFILE WHERE CONSUMER_ID = SENDERCONSUMERID;
     SET SETTIPSAMOUNTCONSUMER = GETTIPSAMOUNTCONSUMER + GETTIPSAMOUNT;


     INSERT INTO NETWORK_COMMUNICATIONS (COMMUNICATIONS_ID,SENDER_CONSUMER_ID,NETWORK_COMM_TYPE_ID,PARENT_COMMUNICATIONS_ID,IS_ACTIVE,LAST_MOD_TIME,CONSUMER_ID) VALUES ('',SENDERCONSUMERID,COMMTYPEID,'0','1',NOW(),CONSUMERID);

     SET LASTINSERTEDID = LAST_INSERT_ID();

     UPDATE CONSUMER_PROFILE SET  CONSUMER_TIPS =  SETTIPSAMOUNTCONSUMER  WHERE CONSUMER_ID = SENDERCONSUMERID;
     INSERT INTO CONSUMER_ACTION_LOG (ACTION_LOG_ID,ACTION_ID,CONSUMER_ID,TIPS_AMOUNT,LAST_MOD_TIME,COMMUNICATIONS_ID,COMM_TYPE_ID) VALUES ('',ACTIONID,SENDERCONSUMERID,GETTIPSAMOUNT,NOW(),LASTINSERTEDID,ACTIONID);     


     INSERT INTO NETWORK_COMMUNICATIONS_MESSAGE (NETWORK_COMMUNICATION_MESSAGE_ID,COMMUNICATIONS_ID,SUBJECT,MESSAGE,IS_ACTIVE,LAST_MOD_TIME,QUESTION_SLUG) VALUES ('',LASTINSERTEDID,QUESTION_POSTED,DESCRIPTION_POSTED,'1',NOW(),QUESTION_SLUG);


     INSERT INTO COMMUNICATION_INTEREST_MAPPING (ID,CONSUMER_INTEREST_EXPERT_ID,CONSUMER_ID,COMMUNICATION_ID,IN_NETWORK,LAST_MOD_TIME) VALUES ('',CATEGORY_ID,SENDERCONSUMERID,LASTINSERTEDID,NETWORK_ID,NOW());    

     IF SENDERCONSUMERID != 0 AND CONSUMERID != 0 AND SENDERCONSUMERID != CONSUMERID THEN
     INSERT INTO CONSUMER_NOTIFICATION (CONSUMER_NOTIFICATION_ID,CONSUMER_ID,SENDER_CONSUMER_ID,ACTION_ID,COMMUNICATIONS_ID,IS_ACTIVE,LAST_MOD_TIME) VALUES  ('',CONSUMERID,SENDERCONSUMERID,COMMTYPEID,LASTINSERTEDID,'1',NOW());
     END IF;
END

It says there are many syntax errors and also unknown variables. In that case it should not work in my localhost. But it did! Im confused!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:10:50+00:00Added an answer on May 20, 2026 at 4:10 pm

    Shouldn’t you change the delimiter if this is to work? Now you have ; halfway that may be causing trouble?

    You can check out this manual page for an example that looks like this:

    mysql> delimiter //
    
    mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
        -> BEGIN
        ->   SELECT COUNT(*) INTO param1 FROM t;
        -> END//
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> delimiter ;
    

    As you can see, the delimiter is set to “//” first. Your first line implies that you are trying to do something like that anyway. Maybe you just forgot to paste the delimiter lines?

    this:

    DROP PROCEDURE `ASKUS_INSERT`// 
    

    would only work with the delimiter set at ‘//’. You should (see example) probably end with // as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On our SQL Server (Version 10.0.1600), I have a stored procedure that I wrote.
Well I have this MySQL stored procedure that I wrote and if I run
I have a stored procedure in MySql that inserts 10.000 registers. When I execute
I have a stored procedure that executes much faster from Sql Server Management Studio
I have a stored procedure (that I didn't write) that uses openquery to populate
I am trying to fix a stored procedure that someone else wrote. Basically the
I have one database. I executed a stored procedure on it. I wrote some
I wrote a stored procedure that restores as set of the database backups. It
We have an stored procedure that we created so that user can write comma
We have an stored procedure that we created so that user can write comma

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.