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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:53:19+00:00 2026-06-14T17:53:19+00:00

can somebody tell me what is wrong with the syntax of my code please?

  • 0

can somebody tell me what is wrong with the syntax of my code please? (this is the exact and only code I’m highlighting and running so line numbers should match up)

CREATE TRIGGER `trg_part_upd` AFTER UPDATE ON `tbl_sub_model_eng_trans_part`
 FOR EACH ROW 
    if NEW.engine_sk = 0 and NEW.trans_sk = 0
    then
        UPDATE tbl_sub_model tsm
        INNER JOIN tbl_fct_sub_eng_trans tfset ON tsm.sub_model_sk = tfset.sub_model_sk
        INNER JOIN tbl_sub_model_eng_trans_part tsmetp ON tfset.trans_sk = tsmetp.trans_sk
        SET tsm.last_modified_date = NOW()
        WHERE tsmetp.sub_model_sk=NEW.sub_model_sk;
    end if;

I get these two errors:

Error Code: 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 ” at line 9

Error Code: 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 ‘end if’ at line 1

  • 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-06-14T17:53:20+00:00Added an answer on June 14, 2026 at 5:53 pm

    You forgot to change the delimiter, so MySQL thinks your first statement is this:

    CREATE TRIGGER `trg_part_upd` AFTER UPDATE ON `tbl_sub_model_eng_trans_part`
     FOR EACH ROW 
        if NEW.engine_sk = 0 and NEW.trans_sk = 0
        then
            UPDATE tbl_sub_model tsm
            INNER JOIN tbl_fct_sub_eng_trans tfset ON tsm.sub_model_sk = tfset.sub_model_sk
            INNER JOIN tbl_sub_model_eng_trans_part tsmetp ON tfset.trans_sk = tsmetp.trans_sk
            SET tsm.last_modified_date = NOW()
            WHERE tsmetp.sub_model_sk=NEW.sub_model_sk;
    

    Just add this before the code:

    DELIMITER $$
    

    … and this afterwards:

    $$
    

    … so MySQL can recognize the complete trigger as a single statement.

    You can change $$ for your own choice.

    Official docs give details on this in the Defining Stored Programs section.


    Please note that this issue only affects MySQL clients that can accept more than one statement at once so they implement a separator to tell them apart. DELIMITER is a command of the mysql command-line tool; it may or may not be implemented in other clients.

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

Sidebar

Related Questions

Specifically, can somebody tell me what is wrong with this piece of code. It
Can somebody tell me what's wrong with this code? 1046: Type was not found
Can somebody tell me why this should be wrong? #Each new term in the
can somebody please tell me where i m wrong why this RMI chat application
Can somebody please tell me what is wrong with the following pom.xml? i'm getting
Can somebody tell me what's wrong with that piece of code : NSString* plistPath
Can somebody please tell me what is wrong with the following applescript set sourceFile
Can somebody tell me what is wrong with this ActionLink? @Html.ActionLink(posts.Title, PostDetails, Blogs, new
can somebody tell me what is wrong? JS Code $.ajax({ url:http://www.google.com/complete/search?qu=chicken, success:function(data){ var test_data
Can somebody please tell me what is wrong here? int arr[15][1]; int main() {

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.