Oracle 10g script how to convert image to pdf and merge multiple pdf file

declare
    OUT_FILE TEXT_IO.FILE_TYPE;
    ITEM VARCHAR2(10000);
   
localpath varchar2(1000);
kumpulanfilepdf varchar2(1000);
    xcrecord number;
    nama_file varchar2(100);
    cursor c is
    select rj_no,a.reg_no,reg_name,vno_sep
    from rstxn_RJHDRS a,rsmst_pasiens b
    where a.reg_no=b.reg_no
    and rj_status='L'
    and cek_bayar='1'
    and klaim_id in (select klaim_id from RSMST_KLAIMTYPES where klaim_status='BPJS')
    and to_char(rj_date,'mm/yyyy')=:tool_rj.bulan;
    c_rec c%rowtype;
   
BEGIN
xcrecord:=1;


        open c;
        loop
            fetch c into c_rec;
          exit when  c%notfound;
    --membuat nama file
    if c_rec.vno_sep is not null then
        nama_file:=c_rec.vno_sep;
    else
        nama_file:=xcrecord;
    end if;
localpath :='c:\RJ\'||replace(:tool_rj.bulan,'/','_')||'\'||nama_file||'_'||replace(c_rec.reg_name, chr(32), '')||'\';   
--////////////COPY bpjs_PATH//////////////////////////
OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');
ITEM := 'md '||localpath||'
del c:\anshary.bat';
TEXT_IO.PUT(OUT_FILE,ITEM);
TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////

host('c:\anshary.bat',NO_SCREEN );
   
 --export KWITANSI TOTAL            
    declare
  pl_id ParamList;
  BEGIN

          pl_id := Get_Parameter_List('tmpdata');
                
                 IF NOT Id_Null(pl_id) THEN
                 Destroy_Parameter_List( pl_id );
                 END IF;
                
                
  pl_id := Create_Parameter_List('tmpdata');
 
   --Add_Parameter(pl_id,'EMP_QUERY',DATA_PARAMETER,'EMP_RECS');
  Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'no');
  Add_Parameter(pl_id, 'rjno', TEXT_PARAMETER, c_rec.rj_no);
  Add_Parameter(pl_id, 'td', TEXT_PARAMETER, c_rec.reg_name);
  Add_Parameter(pl_id, 'Destype' , Text_Parameter , 'File');
  Add_Parameter(pl_id, 'Desname' , Text_Parameter , localpath||'simrs01'||'.pdf');
  Add_Parameter(pl_id, 'Desformat', Text_Parameter , 'Pdf');
   Run_Product(REPORTS, 'exppdfbpjs.rep', SYNCHRONOUS, runtime,FILESYSTEM, pl_id, NULL);
  END;

 xcrecord:=xcrecord+1;

-- ///////////////////////////////
 declare
         cursor cxxx is
    select uploadbpjs
    from RSTXN_RJUPLOADBPJSES
    where rj_no=c_rec.rj_no;
    c_recxxx cxxx%rowtype;
    vbpjspath varchar2(100);
 BEGIN
     select bpjs_path into vbpjspath from rsmst_identitases;   

        open cxxx;
        loop
            fetch cxxx into c_recxxx;
          exit when  cxxx%notfound;
 --////////////COPY bpjs_PATH//////////////////////////
OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');

ITEM := 'copy '||'"'||vbpjspath||c_recxxx.uploadbpjs||'" "'||localpath||'"
del c:\anshary.bat';
TEXT_IO.PUT(OUT_FILE,ITEM);
TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////

host('c:\anshary.bat',NO_SCREEN );

        end loop;
        close cxxx;

 --////////////MERGE PDF//////////////////////////
 select string_AGG(localpath||uploadbpjs) into kumpulanfilepdf from RSTXN_RJUPLOADBPJSES where rj_no=c_rec.rj_no;
 kumpulanfilepdf:=replace(kumpulanfilepdf,',',chr(32));
 OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');
 ITEM := 'gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE='||localpath||nama_file||'.pdf'||' '||kumpulanfilepdf||' '||localpath||'simrs01'||'.pdf
 del '||kumpulanfilepdf||' '||localpath||'simrs01'||'.pdf
 del c:\anshary.bat';
 TEXT_IO.PUT(OUT_FILE,ITEM);
 TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////

host('c:\anshary.bat',NO_SCREEN );
       
        end;
-- ///////////////////////////////       
        end loop;
       
msg_alert('Proses selesai.','I',false);
END;

Adding folder paths to the Windows path variable


I have a little problem when i install ghostscript the command does not work properly, but i know it because the command does not find then path
and if you find the same problem here it's :

    1.Right-click My Computer.
    2.click Properties.
    3.In the System Properties window, click the Advanced tab, and then click Environment Variables.
    4.If the last character is not a semi-colon (;), add one.
    5.After the final semi-colon, type the full path to the file you want to find.

How to use GhostScript for Windows Merge using command line

hi there here it's a simple command line
how to merger more then one .pdf file using ghostscript
:( i found this after a whole day googled
gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=Merged.pdf -dBATCH 1.pdf 2.pdf 3.pdf 4.pdf

Done!
source https://www.rgagnon.com/gp/gp-0015.html
https://superuser.com/questions/1066419/how-to-use-ghostscript-for-windows-to-repair-damaged-pdf-files 

How to remove extra space in between a string? oracle 10g


SQL> select replace('AAA BBB CCC', chr(32), '') from dual;

REPLACE('
---------
AAABBBCCC