use DBI; use DBD::Oracle; use diagnostics; use DBIx::Report::Excel; my $ReportDate ='ABC'; my $SheetName='Test_'.$ReportDate.'.xls'; my $report = DBIx::Report::Excel->new($SheetName); $sql2='select T.Name from TABLENAME T where T.Type = \'MASTER\' and exists (select 1 from TABLENAME T2 where T2.Name = T.Name and T2.Name like \'Data%\')'; print $sql2; $report->dbh(DBI->connect($odbc_dsn,$username,$password)) or die "Could not connect to DB with configuration provided"; print "Retrieving from Database is Starting\n"; $report->sql(' /* --- title: Columns --- */ '.$sql2); $report->write(); $report->close();