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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:59:52+00:00 2026-06-10T00:59:52+00:00

Anybody know what’s wrong with my trigger declaration? CREATE TRIGGER `sch_trigger_curriculum_subject_before_insert` BEFORE INSERT ON

  • 0

Anybody know what’s wrong with my trigger declaration?

CREATE TRIGGER `sch_trigger_curriculum_subject_before_insert` BEFORE INSERT ON  
`sch_curriculum_subject` FOR EACH ROW 
BEGIN
   DECLARE curriculum_code VARCHAR(50);        
   SET curriculum_code = SELECT code FROM sch_curriculum WHERE id=NEW.id;
   SET NEW.`code_name` = CONCAT(curriculum_code,' - ', NEW.code,' - (',NEW.name,')');
END;

The error: SQL Error(1064): You have error in you SQL syntax ….. near ” at line 4.

According to error message, there is something wrong with my curriculum_code declaration. But I cant find out what’s wrong.

Thanks in advance

UPDATE:
already solved, the problem is on delimiter, here is the working one

DELIMITER $$
CREATE TRIGGER `sch_trigger_curriculum_subject_before_insert` BEFORE INSERT ON  
`sch_curriculum_subject` FOR EACH ROW 
BEGIN
  DECLARE curriculum_code VARCHAR(50);        
  SET curriculum_code = (SELECT code FROM sch_curriculum WHERE id=NEW.id);
  SET NEW.`code_name` = CONCAT(curriculum_code,' - ', NEW.code,' - (',NEW.name,')');
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-06-10T00:59:54+00:00Added an answer on June 10, 2026 at 12:59 am

    You need to make sure multiple values are not returned from the SELECT.

    Try:

    SET curriculum_code = (SELECT code FROM sch_curriculum WHERE id=NEW.id LIMIT 1); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody know if it's possible to; Dynamically create LINQ classes for tables/columns that change
Does anybody know how much overhead per single item is required? When I insert
Does anybody know what the default font family is in a table row element?
Anybody know how to create code snippets in Mozilla Bespin. Its strange that there's
Anybody know how I can create an In restriction using Linq to NHibernate. i.e.
Anybody know which is the easy way to insert a json string in cassandra.
anybody know how can I replace \ by \\ ? input string : Télephone
Anybody know of a way to batch NHibernate queries using NHibernate.Linq like you can
Anybody know how to get all of these in a C# app that leads
Anybody know of a good 3rd Party grid control that supports AutoFill (like Excel

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.