Dave, DBI User Group,
Can you take a quick look at the code block below and error messages
being generated when executing.
Any idea why the last 2 characters of the $sql variable are getting
chopped off when "prepare" is executed?
How do I prevent the program from termininating and letting me handle
the error handling? I tried the following DBI::CONNECT statement put
it did not help.
my $dbh = DBI->connect($data_source, $dbUser, $dbPassword, {
PrintError=>0, RaiseError=>0, AutoCommit=>0 });
Code Block in Error:
$sql = "insert into
odba_user.dbh_high_memory_read_sqls
(report_id, query_no,
buffer_gets,
no_executions, sql_text)
values
($reportId, $queryNumber,
$readCount,
$execCount, '$queryText')";
print "\n\nflag11a sql [$sql]\n\n";
$sth = $dbh->prepare("$sql");
undef $rc;
$rc = $sth->execute();
unless (defined $rc) {
printf LOGFILE "statement
execution fail
ed:\n\"$sql\"\n$DBI::errstr\n";
# ignore these insert errors
# $errorCode = 1;
print "flag11\n";
}
My Print Statement of $sql
flag11a sql [insert into odba_user.dbh_high_memory_read_sqls
(report_id, query_no,
buffer_gets,
no_executions, sql_text)
values
(570, 8, 620184,
206727, 'select job,
nvl2(last_date, 1,
0) from sys.job$ where (((:1 <= next_date) and (next_date <= :2)) or
((last_date
is null) and (next_date < :3))) and (field1 = :4 or (field1 = 0 and
''Y'' = :5)
) and (this_date is null) order by next_date, job')]
Perl DBI::PrintError Results (where is the trailing single quote ')
DBD::Oracle::db prepare failed: ORA-01756: quoted string not properly
terminated
(DBD ERROR: OCIStmtPrepare) [for Statement "insert into
odba_user.dbh_high_mem
ory_read_sqls
(report_id, query_no,
buffer_gets,
no_executions, sql_text)
values
(570, 8, 620184,
206727, 'select job,
nvl2(last_date, 1,
0) from sys.job$ where (((:1 <= next_date) and (next_date <= :2)) or
((last_date
is null) and (next_date < :3))) and (field1 = :4 or (field1 = 0 and
''Y'' = :5)
) and (this_date is null) order by next_date, job at
../../bin/DBhealthParseDB.p
l line 653, <REPORTFILE> line 319.
Can't call method "execute" on an undefined value at
../../bin/DBhealthParseDB.
l line 655, <REPORTFILE> line 319.
Issuing rollback() for database handle being DESTROY'd without explicit
disconn
ct(), <REPORTFILE> line 319.
Tony Baier
AT&T ITO DBA Support Services
732 420-2140 office
732 276-6063 vo
732 294-3015 pager
[EMAIL PROTECTED]