Probier mal:
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
#!/usr/bin/perl
use strict;
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use Oraperl;
use db_tool;
use Net::SMTP;
use MIME::Base64 qw(encode_base64);
my $lda = db_connect("dwh_maint") || die "$ora_errstr\n";      
print header(-attachment=>'rfc.csv',-type=>'text/csv');
CSV_wird_generiert();
sub CSV_wird_generiert {
    my $stmt = qq~select M_AUFTRAGSNUMMER, M_LEISTUNGSART, M_PHASENDAUER, 
                  SAP_KST_SENDE, SAP_KST_EMPFANG 
              from MAX_ABR 
              where K_ABRECHNUNGSMONAT = '01.09.2002'~;
    my $cursor = &ora_open($lda,$stmt) or die "$ora_errstr\n";
    while (my @row = &ora_fetch($cursor)){
        $row[4] =~ tr/\n\r//d;
        print join(";",@row[0..4]),"\n";
    }
    &ora_close($cursor);
    &ora_commit($lda) or die "$ora_errstr\n";
}