/*      procedure d'extractiondu fichier cal_rent a partir de la table   */
/*               ren1_cal_rent    */
set pagesize 0
set heading off
set termout off
set feedback off
set linesize 323
set verify off
spool &1\cal_rent.csv
select ren1_cal_rent.cod_etp||';'||
   ren1_cal_rent.cod_vrs_vet||';'||
   RPAD(NVL(version_etape.lim1_vet,' '),35)||';'||
   RPAD(NVL(version_etape.lim2_vet,' '),35)||';'||
   RPAD(NVL(version_etape.lim3_vet,' '),35)||';'||
   NVL(to_char(dat_deb,'DD/MM/YYYY'),'          ')||';'||
   RPAD(NVL(to_char(ren1_cal_rent.HRE_DEB),' '),2)||'h'||
RPAD(NVL(to_char(REN1_CAL_RENT.MIN_DEB),' '),2)
||';'||
   RPAD(nvl(ren1_cal_rent.lib_lieu,' '),82)||';'||
   RPAD(nvl(ren1_cal_rent.commentaire,' '),100)||';'||
   TEM_AFF_RENT||';'
from ren1_cal_rent,version_etape 
where ren1_cal_rent.cod_cge='&2' and
      ren1_cal_rent.cod_etp=version_etape.cod_etp
      and ren1_cal_rent.cod_vrs_vet=version_etape.cod_vrs_vet;
spool off;
end;
exit;
