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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:33:06+00:00 2026-05-27T17:33:06+00:00

im stuck on calling stored procedures inside a SELECT CASE on a Trigger, it

  • 0

im stuck on calling stored procedures inside a SELECT CASE on a Trigger, it gaves me the following error:

[Err] 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 'empata(NEW.eqvis))
            WHEN 'loc' THEN pierde(NEW.eqvis)
            WHEN 'vis' THEN g' at line 16

Here is the code:

DELIMITER |
CREATE TRIGGER updpartido AFTER UPDATE ON partidos
FOR EACH ROW
    BEGIN
        SET @vgls = vgoles(NEW.eqvis);
        SET @lgls = vgoles(NEW.eqloc);
        SET @vglsec = vgolesec(NEW.eqvis);
        SET @lglsec = vgolesec(NEW.eqloc);
        SELECT CASE 
            WHEN @vgls=@lgls THEN "emp"
            WHEN @vgls>@lgls THEN "loc"
            WHEN @vgls<@lgls THEN "vis" 
        END
        INTO @st;

        SELECT CASE @st
            WHEN 'emp' THEN CALL empata(NEW.eqvis)
            WHEN 'loc' THEN CALL pierde(NEW.eqvis)
            WHEN 'vis' THEN CALL gana(NEW.eqvis)
        END
        INTO @dat;

        SELECT CASE @st
            WHEN 'emp' THEN CALL empata(NEW.eqloc)
            WHEN 'vis' THEN CALL pierde(NEW.eqloc)
            WHEN 'loc' THEN CALL gana(NEW.eqloc)
        END
        INTO @dat2;

        UPDATE equipos SET gf=@vgls,gc=@vglsec WHERE id=NEW.eqvis;
        UPDATE equipos SET gf=@lgls,gc=@lglsec WHERE id=NEW.eqloc;
    END;

|

But if i remove the “CALL” the Triggers adds but when i do some update it gives me the error of “FUNCTION not found” since i made them as stored procedures and not as functions because im not going to return nothing…

Any help is very appreciated!

  • 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-27T17:33:07+00:00Added an answer on May 27, 2026 at 5:33 pm

    You can convert your procedures empata, pierde, and gana into functions and use as coded in the first example below:

    -- works
    SET @st = 'loc';
    SELECT CASE @st
      WHEN 'loc' THEN function_(@st)
    END
    INTO @dat;
    SELECT @dat;
    

    I tested the following scenarios and they didn’t work:

    -- won't work
    SET @st = 'loc';
    IF @st = 'loc' THEN
        function_(@st);
    END IF;
    
    -- won't work
    SET @st = 'loc';
    SELECT CASE @st
      WHEN 'loc' THEN CALL stored_procedure_(@st)
    END
    INTO @dat;
    SELECT @dat;
    
    -- won't work
    SET @st = 'loc';
    IF @st = 'loc' THEN
        CALL stored_procedure_(@st);
    END IF;
    

    At the very least, they didn’t work for me.

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

Sidebar

Related Questions

Being stuck with a legacy database schema that no longer reflects your data model
Kinda stuck here... I have an application with lets say 5000 rows of data
I am using mysql 5.0. I have a stored procedure which gets all the
Im kinda stuck. I have an activity in my app that just wont go
I have a search function that executes a stored procedure and returns results. If
The problem is I have a stored procedure that runs consistently in Sql Server
I'm developing a video streaming application and I'm getting stuck when calling set setDataSource
I am stuck with SimpleCursorAdapter, I am calling my local SQLite DB and putting
I am getting following error and I can't resolve it. <%@ Page Language=VB MasterPageFile
I have a generic method to call a stored Procedure in ASP.NET: public SqlDataReader

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.