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 7620421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:56:02+00:00 2026-05-31T03:56:02+00:00

I got the exception to create. Can anybody help me? How to write nested

  • 0

I got the exception to create. Can anybody help me? How to write nested loop in stored procedure in Mysql the proper way and what is my wrong?

DELIMITER $$

`INVESTMENT_MATCH_POINT_CREATOR`(_percentage INT, _vat_tex INT)
BEGIN
    DECLARE _user_id INT; 
    DECLARE _package_id INT;


    DECLARE _left_investment INT;
    DECLARE _right_investment INT;

    DECLARE _left_point INT;
    DECLARE _right_point INT;

    DECLARE _left_carry_point INT;
    DECLARE _right_carry_point INT;

    DECLARE _get_point INT;

    DECLARE done BOOLEAN DEFAULT FALSE;
    DECLARE _user_investment_table CURSOR FOR SELECT user_id,package_id,left_invesetment,right_investment DATA FROM user_investment_match;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

    OPEN _user_investment_table;

    read_loop:LOOP

    FETCH _user_investment_table INTO _user_id,_package_id,_left_investment,_right_investment;

    IF done THEN 
    LEAVE read_loop;
    END IF;

        BEGIN
                DECLARE _match_point INT; 
                DECLARE done2 BOOLEAN DEFAULT FALSE;

                DECLARE _package_match_point_table CURSOR FOR SELECT match_point DATA FROM package_match_points WHERE package_id=_package_id ORDER BY match_point DESC;
                DECLARE CONTINUE HANDLER FOR NOT FOUND SET done2 = TRUE;

                OPEN _package_match_point_table;
                read_loop2:LOOP

                FETCH _package_match_point_table INTO _match_point;

                    IF done2 THEN 
                    LEAVE read_loop2;
                    END IF;

                    /*if(_match_point=<_left_investment) and (_match_point=<_right_investment) then
                        set _left_point=abs(_left_investment-_match_point);
                        set _right_point=abs(_right_investment-_match_point);
                        set _get_point=((_match_point*_percentage)/100);
                    end if;*/

                END LOOP;
                CLOSE _package_match_point_table;
            END$$




    END LOOP;
    CLOSE _user_investment_table;

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-31T03:56:03+00:00Added an answer on May 31, 2026 at 3:56 am

    You should use the specified delimiter only at the end of the procedure, however in your code you are using the $$ delimiter at the end of the inner block, (and in other words you are using the $$ delimiter which signals the end of the procedure before it is actually ended)

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

Sidebar

Related Questions

Why I can't create CroppedBitmap in the following code? I got an exception: The
I got this error message and I'm not quite sure whats wrong: Exception in
What is wrong with this code ? I got this exception on the last
I've got exception about convert NULL to Int32. I've got a table from database
I got a strange exception when trying to find out if a property in
I got this error Unhandled exception at 0x0049b946 in Program.exe: 0xC0000005: Access violation reading
I got an out of memory exception in a photo editor thingy i was
I got the following Design time exception for my control in WPF System.NotImplementedException The
i got a webservicedefinition like this: [OperationContract] [FaultContract(typeof(Exception))] [WebInvoke(ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped,
I got below mentioned code for adding my application to Windows Firewall Exception list.

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.