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))
ad esempio:se vgroupid = -1
, l'ultima condizione sarà (((GROUPID = -1) AND (-1 > -1)) OR (-1 = -1))
o ((forever_false AND forever_false) OR (forever_true))
o (-1 = -1)
- tutti i record
invece, se vgroupid = 123
l'ultima condizione sarà (((GROUPID = 123) AND (123 > -1)) OR (123 = -1))
o (((GROUPID = 123) and forever_true) OR (forever_false))
o (GROUPID = 123)
- solo 123 GROUPID