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

  • Home
  • SEARCH
  • 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 8863223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:55:26+00:00 2026-06-14T15:55:26+00:00

Table structure is: mysql> DESC groups; +————–+————–+——+—–+———+——-+ | Field | Type | Null |

  • 0

Table structure is:

mysql> DESC groups;
+--------------+--------------+------+-----+---------+-------+
| Field        | Type         | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| PKey         | varchar(64)  | NO   | PRI | NULL    |       |
| group_name   | varchar(64)  | YES  |     | NULL    |       |
| Region       | varchar(128) | NO   |     | NULL    |       |
| Role         | varchar(128) | NO   |     | NULL    |       |
| parent_group | varchar(64)  | NO   | MUL | NULL    |       |
+--------------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

When i am executing this Trigger , i’m having a compilation error

DELIMITER $$
CREATE
    TRIGGER `group_before_delete` BEFORE DELETE
    ON `groups`
    FOR EACH ROW BEGIN
    IF old.parent_group=old.PKey THEN
        UPDATE `Error: deletion RootGroup is prohibited!`;
    ELSE              
        UPDATE groups
        SET parent_group=old.parent_group
        WHERE parent_group=old.Pkey; 
    END IF;
    END$$
DELIMITER ;

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 ‘;
ELSE
t_group=old.parent_group
t_group=old.PKey;
END IF;’ at line 6
mysql> DELIMITER ;


Can you tell me what i’m missing here ??

  • 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-14T15:55:27+00:00Added an answer on June 14, 2026 at 3:55 pm

    In your IF statement, the following is not a valid SQL statement:

    UPDATE `Error: deletion RootGroup is prohibited!`;
    

    This should be this:

    IF old.parent_group=old.PKey THEN
        UPDATE `Error: deletion RootGroup is prohibited!` set x=1;
    ELSE              
        UPDATE groups
        SET parent_group=old.parent_group
        WHERE parent_group=old.PKey; 
    END IF;
    

    I have never done things this way. It is a bit of an ugly way of doing it. But if it works, what the heck.

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

Sidebar

Related Questions

I have a mysql table structure like that: id int primary key name varchar
I have the following MySQL Table Structure: mysql> desc customers; +---------------------+-------------+------+-----+---------+-------+ | Field |
I have the following MySQL table structure: num field company phone website 1 Gas
The mysql table that I'm using has a structure: id | type | date
I have a MYSQL Table with the following structure called daily_measurements +------------+----------+------+-----+---------------------+----------------+ | Field
Ok so i have a database table called requests with this structure mysql> desc
Table structure: CREATE TABLE `mytable` ( `id` varchar(8) NOT NULL, `event` varchar(32) NOT NULL,
I have the following table structure (in MySQL): DocID, Code, IsDup, DopOf , where
I have an table structure like this mysql> SELECT id, name, parent_id FROM categories;
I have a mysql database with a table structure like below : Table Name

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.