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

  • Home
  • SEARCH
  • 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 6749869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:44:29+00:00 2026-05-26T12:44:29+00:00

Everytime call this stored procedure i get this error: #1064 – You have an

  • 0

Everytime call this stored procedure i get this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1

What seems to be the problem?

Here is the code:

DELIMITER $$

DROP PROCEDURE IF EXISTS `singledb`.`TOUR_TRANSFER`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `TOUR_TRANSFER`()
BEGIN

BEGIN -- for rubric table
            DECLARE tblRubric_rubric_id INT;
            SET @qry = concat('SELECT count(*) into ',tblRubric_rubric_id,' FROM zerodb2.tour_template');
            PREPARE statement FROM @qry;
            EXECUTE statement;

            SELECT tblRubric_rubric_id;
END;
END$$

DELIMITER ;
  • 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-26T12:44:29+00:00Added an answer on May 26, 2026 at 12:44 pm

    From http://bugs.mysql.com/bug.php?id=15263:

    "Parameter markers can be used only where data values should appear,
    not for SQL keywords, identifiers, and so forth."

    So, we can not do:

    PREPARE stmt FROM 'SELECT id INTO ? FROM t1';
    

    We can not use ? instead of identifier (variable name).

    And when you use parameter name:

    PREPARE stmt FROM 'SELECT id INTO rid FROM t1';
    

    in the string being prepared, then server simply do not know what that rid refers to in statement you are trying to prepare. You may try to prepare it outside SP with the same result:

    mysql> prepare stmt from 'select id into p from t1';
    ERROR 1327 (42000): Undeclared variable: p
    

    So I just used user variable, see below:

    DROP PROCEDURE IF EXISTS `singledb`.`TOUR_TRANSFER`$$
    
    CREATE DEFINER=`root`@`localhost` PROCEDURE `TOUR_TRANSFER`()
    BEGIN
      BEGIN -- for rubric table
        -- DECLARE @tblRubric_rubric_id INT;
    
        SET @tblRubric_rubric_id := 0;
        SET @qry = 'SELECT count(*) into @tblRubric_rubric_id FROM zerodb2.tour_template';
        PREPARE statement FROM @qry;
        EXECUTE statement;
      END;
    END$$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario I have a stored procedure written in T-Sql using SQL Server 2005. SEL_ValuesByAssetName
I'm trying to call a stored procedure (on a SQL 2005 server) from C#,
The problem is I have a stored procedure that runs consistently in Sql Server
Everytime my application runs a stored procedure it does something like this: using (DbBase
I have content stored in a Postgres DB, now everytime I call the content
Everytime i retrieve data from a mysql stored procedure with a concat function an
I have discovered recently that's possible to call anoymous blocks from jdbc like this:
Has anyone seen this error when trying to call an external C function from
I have a stored procedure which is erroring with Timeout expired. The code involved
In my stored procedure I have to pass a table and column name which

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.