CURSOR c
IS
SELECT COMPANYID,
GROUPID,
PERIODID,
FN_PPROCESSCURRENT
FROM LIQUIDATIONSDETAILS
WHERE PROCESSID = FN_PPROCESSPREVIOUS
AND (UNCOLLECTED > 0 OR INVOICE = 0)
AND (((GROUPID = vgroupid) AND (vgroupid > -1)) OR (vgroupid = -1))
na przykład:jeśli vgroupid = -1
, wtedy ostatnim warunkiem będzie (((GROUPID = -1) AND (-1 > -1)) OR (-1 = -1))
lub ((forever_false AND forever_false) OR (forever_true))
lub (-1 = -1)
- wszystkie rekordy
zamiast tego, jeśli vgroupid = 123
ostatnim warunkiem będzie (((GROUPID = 123) AND (123 > -1)) OR (123 = -1))
lub (((GROUPID = 123) and forever_true) OR (forever_false))
lub (GROUPID = 123)
- tylko 123 GROUPID