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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:45:55+00:00 2026-05-30T21:45:55+00:00

mysql> select * from S_TABLE; +——–+——————–+ | S_ID | S_TITLE | +——–+——————–+ | 1

  • 0
mysql> select * from S_TABLE;
+--------+--------------------+
|   S_ID | S_TITLE            |
+--------+--------------------+
|      1 |  Jim               |
|      2 |  George            |
|      3 |  Sam               |
|      4 |  Zoe               |
+--------+--------------------+

mysql> select * from F_TABLE;
+--------+--------+--------------+----------+
| F_ID   |  S_ID  | F_VALUE      | F_TITLE  |
+--------+--------+--------------+----------+
|      1 |      1 | 4.5          | Delta    |
|      2 |      2 | 24.5         | Gamma    |
|      3 |      3 | 44.4         | RHO      |
|      4 |      3 | 5.0          | Beta     |
+--------+--------+--------------+----------+

mysql> select * from Results; // Hence this table is empty
+--------+-------------+
| Fstuff | Sstuff      |
+--------+-------------+
|        |             |
+--------+-------------+

This stored procedure does a frivolous computation

DELIMITER ##
CREATE PROCEDURE zap(IN sss VARCHAR(30))
BEGIN 

INSERT INTO Results (fstuff, Sstuff)
Select 
f.F_VALUE * 0 + 123,
s.S_TITLE
FROM F_TABLE f
JOIN S_TABLE s ON s.S_ID=f.S_ID
WHERE s.S_TITLE LIKE CONCAT('%', sss, '%');

END ##
DELIMITER ;

This stored procedure calls zap

DELIMITER ##
CREATE PROCEDURE crap()
BEGIN
    DECLARE fTit VARCHAR(30);
    DECLARE done INT DEFAULT 0;
    DECLARE cur CURSOR FOR SELECT F_TITLE FROM F_TABLE;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

    OPEN cur;
    read_loop: LOOP

        FETCH cur INTO fTit;

        IF done 
            THEN LEAVE read_loop;
        END IF;

        call Zap(fTit);
        COMMIT;

    END LOOP;
    CLOSE cur;

END ##
DELIMITER ;

Problem: Result table becomes uneffected? I cant figure out why

  • 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-30T21:45:56+00:00Added an answer on May 30, 2026 at 9:45 pm

    You read out the names from F_TABLE.F_TITLE (Delta,Gamma…) and look for them in S_TABLE.S_TITLE and there is no match.

    The cursor in crap should use the same title column as the zap procedure.

    edit:

    The cursor cur CURSOR FOR SELECT F_TITLE FROM F_TABLE; will fetch ‘Delta’,’Gamma’ and so on into fTit. Then Zap() is called:
    Zap('Delta'), Zap('Gamma') etc.

    The Zap procedure will create a match string '%Delta%', '%Gamma%' and so on and look for this in the first table you listed. Since that table contains ‘Jim’, ‘George’ and other names there is no match. The SELECT returns no rows so there is nothing inserted in any of the calls to zap.

    If you change the cursor to instead look in S_TABLE you will get rows inserted, but maybe not the ones you want. Please explain more what you expect in the results table.

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

Sidebar

Related Questions

let's say mysql is something like this select x,y from xx group by y
Two snippets of MySQL: SELECT * FROM annoyingly_long_left_hand_table LEFT JOIN annoyingly_long_right_hand_table ON annoyingly_long_left_hand_table.id =
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE
which is more efficient (when managing over 100K records): A. Mysql SELECT * FROM
In MySQL Select 1 from mytable and select null from mytable both return the
Consider these three mysql statements: select * from Users; select id, title, value from
I have a MySQL query SELECT * FROM 'redirect' WHERE 'user_id'= \''.$_SESSION['user_id'].' \' ORDER
How could I make this kind of query e.g. in MySQL SELECT * FROM
I am running this query on MySQL SELECT ID FROM ( SELECT ID, msisdn
I have a long list generated from a simple mysql select query. Currently (shown

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.