CREATE OR REPLACE PROCEDURE ARQUIVO_DACON_T9(
   P_NRSEQARQMAG  IN ARQMAGNETICO.NRSEQARQMAG%TYPE,
   P_REGGERAL     IN NUMBER) 

AS
   V_CONTREGT9        NUMBER;

BEGIN

  V_CONTREGT9:= P_REGGERAL-1;

 /*------------------------------REG_T9---------------------------------*/

        FOR C_REG_T9 IN (SELECT (RPAD('T9',2,' ')                     ||
                                 LPAD(V_CONTREGT9,5,'0')              ||
                                 LPAD(' ',226,' ')                    ||
                                 LPAD('0',10,'0')         ) AS REG_T9
                           FROM DUAL) LOOP

      INSERT INTO ARQMAGNETICO
         (NRORDREGARQ, DSREGARQMAG, NRSEQARQMAG)
      VALUES
         ('26'||LPAD(RTRIM(V_CONTREGT9), 8, '0'), C_REG_T9.REG_T9, P_NRSEQARQMAG);

   END LOOP;

END;
/