--------------------------------------------------------
--  DDL for Procedure MANAGE_REQ_HGROUP_ORDER
--------------------------------------------------------
set define off;

  CREATE OR REPLACE EDITIONABLE PROCEDURE "ENVX_OPER"."MANAGE_REQ_HGROUP_ORDER" (
    pi_id_request           IN  NUMBER,
    pi_id_req_hgroup_level  IN  VARCHAR2
) AS
    i NUMBER := 0;
BEGIN
    FOR hg_ord IN (
        SELECT id_req_hgroup
          FROM deployment_req_hgroup hg
         WHERE hg.id_request = pi_id_request
           AND hg.id_req_hgroup_level = pi_id_req_hgroup_level
         ORDER BY req_hgroup_order
    ) LOOP
        i := i + 1;
        UPDATE deployment_req_hgroup
           SET req_hgroup_order = i
         WHERE id_req_hgroup = hg_ord.id_req_hgroup;

    END LOOP;

    COMMIT;
END manage_req_hgroup_order;


/
