1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| CREATE OR REPLACE
PROCEDURE LIST_SEUIL
( INMODE IN NUMBER,
rc out Pkg_Reference.MRefCursor
) AS
VCNT Integer;
cursor A_CUR is SELECT
LOCALID,QMIN,NOM,DESCR,QMAX,IDTYPE,IDSOUSTYPE,CoalEsce(MOD_FOU_IID,FOU_IID) as FOUID,REF
FROM j_catalogue WHERE QMIN>0 and QMIN is not null;
A_LIGNE A_CUR%ROWTYPE;
BEGIN
OPEN A_CUR;
LOOP
FETCH A_CUR into A_Ligne;
EXIT WHEN A_CUR%NOTFOUND;
TOTAL := 0;
select count(*) into TOTAL from j_stock J where J.CAT_IID=LOCALID and J.date_out is null;
if (INMODE=0) then
if (TOTAL<QMIN) then
--suspend; // selon les params et les résultats, je renvoi ou non l'enregistrement
-- ici j'aimerais passer mon A_Ligne dans le curseur RC de sortie...
end if;
end if;
if (INMODE=1) then
if ((TOTAL + (TOTAL * / 10)) < QMIN) then
--suspend; // selon les params et les résultats, je renvoi ou non l'enregistrement
end if;
end if;
if (INMODE=2) then
if (TOTAL>QMAX) then
--suspend; // selon les params et les résultats, je renvoi ou non l'enregistrement
end if;
end if;
END LOOP;
CLOSE A_CUR;
-- open rc for select ...;
END LIST_SEUIL; |
Partager