3
I did not find a SQL statenment IF
in Sqlite and the closest was the CASE
, that this attending me, meanwhile would like to suspend a Trigger upon a conditional and believe that can only be done with IF
CREATE TRIGGER...
BEGIN
IF (SELECT COUNT(*) FROM DATA < 900) THEN
SUSPEND;
...
END;
It is possible to do something like this in Sqlite?
Not like this the way you want it. The triggers only have DML commands. The best I ever did was to put the condition in any and all
where
of the Rigger Queries– Jefferson Quesado
I thought about it but it would be a {IF} to define of do or not a {INSERT} ie in Trigger the {INSERT} could only be executed if meet the condition and I do not see where to put a {WHERE} in this case.
– fdavid
has a construction that is the
INSERT INTO ... SELECT ...
, where theSELECT
is a traditional selection. Unfortunately there is noIF
nor variables in Sqlite, can not program much– Jefferson Quesado
Will Trigger’s WHEN is possible to make two conditions, today I already have an AFTER UPDATE ... WHEN field = 1. Ai could put a SELECT COUNT(*)... >= 900
– fdavid
never seen
WHEN
in Sqlite grammar for triggers. Maybe lack of attention from my– Jefferson Quesado
Thank you for Brainstorm Jefferson.
– fdavid