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))
for eksempel:if vgroupid = -1
, så vil den sidste betingelse være (((GROUPID = -1) AND (-1 > -1)) OR (-1 = -1))
eller ((forever_false AND forever_false) OR (forever_true))
eller (-1 = -1)
- alle poster
i stedet hvis vgroupid = 123
sidste betingelse vil være (((GROUPID = 123) AND (123 > -1)) OR (123 = -1))
eller (((GROUPID = 123) and forever_true) OR (forever_false))
eller (GROUPID = 123)
- kun 123 GROUPID