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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:53:58+00:00 2026-05-28T22:53:58+00:00

I am trying to create an update trigger in MySQL Community Server 5.5.16 but

  • 0

I am trying to create an update trigger in MySQL Community Server 5.5.16 but I have got an error:

ERROR 1064 (42000): 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 'REFER
ENCING NEW TABLE AS ntable
BEGIN atomic
        DECLARE n_overdraft INTEGER;
        DECL' at line 1

Could anyone help me with this problem. Thanks.
Here is my code:

CREATE TABLE overdraft(account_no INTEGER,over_draft INTEGER);

DELIMETER //
CREATE TRIGGER t_creditexceed AFTER UPDATE ON Account REFERENCING NEW TABLE AS ntable
BEGIN atomic
    DECLARE n_overdraft INTEGER;
    DECLARE n_balance INTEGER;
    DECLARE n_number INTEGER;
    DECLARE n_credit INTEGER;
    DECLARE credit_exception condition for SQLSTATE '07030';

    SELECT balance, credit, number INTO n_balance, n_credit, n_number
    FROM ntable;
    IF ((n_balance < (-n_credit)) AND (n_balance >= 1.1 * (-n_credit)))
    THEN
    SET n_overdraft = n_balance + n_credit;
    INSERT INTO overdraft (account_no, over_draft) VALUES (n_number, n_overdraft);
    END IF;
    IF (n_balance < 1.1 *(- n_credit))
    THEN signal credit_exception;
    END IF;
END;
//
  • 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-28T22:53:59+00:00Added an answer on May 28, 2026 at 10:53 pm

    Just needed to delete REFERENCING NEW TABLE AS ntable and atomic because it’s not MySQL Server standard.

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

Sidebar

Related Questions

I am trying to create an update trigger in MySQL Community Server 5.5.16. I
I'm trying to create a simple trigger using TSQL (or SQL Server 2008). The
I am trying to create a trigger in Oracle. I know sql but i
I am trying to create a trigger in SQL Server 2008 which inserts a
I am trying to create Update trigger which should be invoked only if the
I'm trying to create an SQL query in PHP to update a table. Is
With MySQL 5.1.43. I am trying to create a trigger like this: USE `databaseA`;
I'm trying to create DB2 trigger which is using the procedure VOTES_COUNT but when
hi i'm trying to update two different tables with one trigger but i keep
I am trying to create a trigger. It is supposed to update any new

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.