0

I need execute a trigger INSERT after adding row at table subscrubetousers with a condition:

subscrubetousers.SubscrubeToUsersType = 9

BEGIN
   INSERT INTO logsub Set 
   LogTime = NEW.subscrubetousersTime, 
   LogIdNote = NEW.subscrubetousersId, 
   LogType = NEW.SubscrubeToUsersType;
END

1 Answer 1

2

Just add a condition to your trigger body:

BEGIN
   IF NEW.SubscrubeToUsersType = 9 THEN
       INSERT INTO logsub (LogTime,LogIdNote,LogType) 
       VALUES (NEW.subscrubetousersTime, NEW.subscrubetousersId,NEW.SubscrubeToUsersType);
    END IF;
END
Sign up to request clarification or add additional context in comments.

6 Comments

can i know from where did this new came from ??
It not possible... what is your goal?
i have sen a similar question like this ..which uses new in triggers ..is there something to do with new in triggers ??
I still don't understand you, NEW is a reference to new record to be insert(ed) in table, you cam manipulate NEW as you need... now the question is: What is your needs/requirements/goals with this trigger?
Thank you! Can you explain please with a Trigger Update?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.