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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:07:51+00:00 2026-05-27T00:07:51+00:00

Someone told me that I need to use a delimiter in my trigger. I’m

  • 0

Someone told me that I need to use a delimiter in my trigger. I’m looking at the MySQL manual page, and I’m finding it in the example; however, it’s not in the generic documentation.

Here’s the code I am trying to correct:

CREATE TRIGGER adult BEFORE INSERT OR UPDATE ON table5.column5
FOR EACH ROW BEGIN
  UPDATE table1 SET column5 = table5.column5 WHERE table5id = table1xtable5.table5id WHERE table1xtable5.table1id = OLD.table1.id$
END$

Honestly, I have no idea how to do this, and the documentation at http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html seems like a horribly inadequate reference. For example, when reading about “old” and “new“, it references the “subject table“–the table associated with the trigger. There are two tables associated with this trigger, and I’m actually trying to associate more tables with this trigger…. When looking at the example code, the UPDATE line, which effects table4, only columns within table4 are used (they’re adding 1 to the value). Also, they’re using WHERE ~ a3 = NEW.a1. I don’t think that id’s work that way. There shouldn’t be a universal ID that works across tables. They should definitely be using an interdependency table in the example, for applicability.

I actually asked a similar question earlier today about what a good method for doing this would be, but now I’m wondering, simply, if there is a method. Thanks for reading. 🙂

Here is an example of a trigger that updates another table, but it doesn’t seem to use a delimeter:

CREATE TRIGGER mytrigger BEFORE INSERT ON odp 
FOR EACH ROW
  UPDATE total_points SET points = points + NEW.points;

What isn’t explained in this example is how odp and total_points overlap. How can we be sure that the total_points table’s points row is the correct points row? Which row in the points table would MySQL update? x//

So, shouldn’t there be some way to specify which of the total_points.points rows to update BEFORE INSERT ON odp?

  • 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-27T00:07:51+00:00Added an answer on May 27, 2026 at 12:07 am

    Part 1

    The delimiters are used for source objects like stored procedure/function, trigger or event. All these objects may have a body – code within BEGIN…END clause.

    All statement in MySQL scripts should be ended with delimiter, the default is ‘;’. But what to do if source object has body with some statements, e,g:

    INSERT INTO table1 VALUES(1);
    
    CREATE PROCEDURE procedure1()
    BEGIN
      SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
      PREPARE stmt2 FROM @s;
      SET @a = 6;
      SET @b = 8;
      EXECUTE stmt2 USING @a, @b;
    END;
    
    INSERT INTO table1 VALUES(2);
    

    How many statemants? 3 or 8? The answer is three, because script has two INSERTs and one CREATE PROCEDURE statements. As you see, CREATE PROCEDURE has some internal statements too; we should say to MySQL client that all these statement (inside BEGIN…END) – are part of ONE statement; we can do it with a help of delimiters:

    INSERT INTO table1 VALUES(1);
    
    DELIMITER $$
    
    CREATE PROCEDURE procedure1()
    BEGIN
      SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
      PREPARE stmt2 FROM @s;
      SET @a = 6;
      SET @b = 8;
      EXECUTE stmt2 USING @a, @b;
    END$$
    
    DELIMITER ;
    
    INSERT INTO table1 VALUES(2);
    

    Note, when your trigger has no BEGIN…END clause, delimiters may be omitted.


    Part 2

    Without delimiters the statement will be parsed as –

    CREATE PROCEDURE procedure1()
    BEGIN
      SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
    

    instead of –

    CREATE PROCEDURE procedure1()
    BEGIN
      SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
      PREPARE stmt2 FROM @s;
      SET @a = 6;
      SET @b = 8;
      EXECUTE stmt2 USING @a, @b;
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been told that I need to use the registerDefaults: to load the NSUserDefaults
Someone told me that openGL is for graphic only, and that it's very bad
So, I was told by someone that a good way to resolve ambiguities in
im learning to use openGL and iv been told that because my wheel arches
I have been told that I can use the opengraph, and other FB/Twitter protocols
I've been told that I should use size_t always when I want 32bit unsigned
Someone told me to do this in order to keep track of latest people
Someone told me once there was a good novel around the story of the
Someone on IRC told me I could create objective c objects directly from plist
Someone brought up the MySQLi multi_query function in an answer claiming that it would

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.