It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.
Working code with static value:
BEGIN ATOMIC
DECLARE @REMAINDER DECIMAL(8,2) DEFAULT NULL;
SET @REMAINDER = 100 - 70;
UPDATE PROD_INFO
SET SALE_PRICE = (COST / @REMAINDER) * 100;
END
I have tried the below which results in A "not valid in the context where it is used" error;
BEGIN ATOMIC
DECLARE @REMAINDER DECIMAL(8,2) DEFAULT NULL;
SET @REMAINDER = 100 - PROD_INFO.GP;
UPDATE PROD_INFO
SET SALE_PRICE = (COST / @REMAINDER) * 100;
END
CREATE TRIGGER GENRES."mytrigger"
AFTER UPDATE OF COST ON PROD_INFO
REFERENCING NEW AS n
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
DECLARE REMAINDER DECIMAL(8,2) DEFAULT NULL;
SELECT 100 - n.GP INTO REMAINDER FROM PROD_INFO;
UPDATE PROD_INFO
SET n.SALE_PRICE = (COST / REMAINDER) * 100;
END
CREATE TRIGGER FATDUCK."mytrigger" NO CASCADE BEFORE UPDATE OF COST ON PROD_INFO REFERENCING OLD AS o NEW AS newr
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET newr.SALE_PRICE = (newr.COST / (100 - newr.GP)) * 100;
END
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.