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))
till exempel:if vgroupid = -1
, då kommer det sista villkoret att vara (((GROUPID = -1) AND (-1 > -1)) OR (-1 = -1))
eller ((forever_false AND forever_false) OR (forever_true))
eller (-1 = -1)
- alla poster
istället om vgroupid = 123
sista villkoret är (((GROUPID = 123) AND (123 > -1)) OR (123 = -1))
eller (((GROUPID = 123) and forever_true) OR (forever_false))
eller (GROUPID = 123)
- endast 123 GROUPID