SQL Database Schema Developer

  • Job Duration01 to 03 months
  • Project LevelExpensive
  • Project deadlineExpired

Project detail

Need help setting up MySQL tables with generated stored columns. Before & After INSERT, UPDATE logic with selection constraints. If you don’t have experience with these advanced skill sets, don’t apply. For example the code below does not work. There are more updates like this that need to be done.

Operation failed: There was an error while applying the SQL script to the database.
Executing:
DROP TRIGGER IF EXISTS `cpw_ems`.`tbl_product_pricing_BEFORE_UPDATE`;

DELIMITER $$
USE `cpw_ems`$$
CREATE TRIGGER `cpw_ems`.`tbl_product_pricing_BEFORE_UPDATE`
BEFORE UPDATE ON `cpw_ems.tbl_product_pricing`
FOR EACH ROW
BEGIN
declare addon decimal(8,2);
SELECT pp.new_map_rounded_price as addon_price
FROM cpw_ems.tbl_product_pricing as pp
where pp.product_id = NEW.web_base_product_map_id and pp.supplier_id = NEW.supplier_id;
set NEW.web_base_product_map_price = addon_price;
END$$
DELIMITER ;

ERROR 1415: Not allowed to return a result set from a trigger
SQL Statement:
CREATE TRIGGER `cpw_ems`.`tbl_product_pricing_BEFORE_UPDATE`
BEFORE UPDATE ON `cpw_ems.tbl_product_pricing`
FOR EACH ROW
BEGIN
declare addon decimal(8,2);
SELECT pp.new_map_rounded_price as addon_price
FROM cpw_ems.tbl_product_pricing as pp
where pp.product_id = NEW.web_base_product_map_id and pp.supplier_id = NEW.supplier_id;
set NEW.web_base_product_map_price = addon_price;
END

Skills Required

Industry Categories

Freelancer type required for this project