>This would be nice if this was a ratings/comments list, but this is a
>programming DBI list.  Everything that you described below, we would
>need to
>have in actual code, not necessarily the whole module, but snippets that
>refer to the problem area.  We can then comment on what is it you are
>doing
>wrong and give suggestions.  There should not big a big time difference
>in
>SQLPLus Vs. Perl DBI, so it must be something in your code that is
>causing
>it.

Sorry, I thought it may have been a common problem.  Here's the code
that I use, and the sql script is attatched.

                open SQL_SCRIPT, "< $sql_script_path"
                    or error_log_entry("Can't open sql script: $!");

                # Preprocess script file
                while (<SQL_SCRIPT>) {
                        $query .= $_;
                }

                close SQL_SCRIPT;

                # Apply parameters 
                # There was a paremeter binding problem with the
                # current format of the .sql scripts
                @params = $report->arguments;
                for ($i = 1; $i <= @params; $i++) {
                    eval ('$query =~ s/&'.$i.'/'.$params[$i-1].'/g;');

                    for ($j = 0; $j <= $#center_headers; $j++) {
                        eval('$center_headers['.$j.'] =~
s/&'.$i.'/'.$params[$i-1].'/g;');
                    }
                }
                
                # Connect to database and execute query
                my $dbh = DBI->connect(
                    $REPORTS::DBI_REPORT_CONNECT_STRING,
                    $REPORTS::DBI_REPORT_USERNAME,
                    $REPORTS::DBI_REPORT_PASSWORD
                ) or error_log_entry("Cannot connect to Oracle database:
$DBI::errstr\n");

                my $sth = $dbh->prepare( $query )
                    or error_log_entry("Could not prepare statement:
$DBI::errstr\n");

                $sth->execute()
                    or error_log_entry("Could not execute statement:
$DBI::errstr\n");

This is the relevant code, the rest deals with report
generation and job activation.

Hope this was more helpful.

-- 
Bob Phan <[EMAIL PROTECTED]>
Neurogen Corporation

xplus3.sql

Reply via email to