On Wed, 13 Nov 2002 16:05:02 -0800 Steven Hajducko <[EMAIL PROTECTED]> wrote:
> Why use eval? I believe ( from my minor experience here.. ) that
> eval is meant to do 2 things.
>
> a) execute code at runtime -
Both parse and execute.
> my $code_snip = "print 'hi\n'";
> eval $code_snip
>
> would print:
>
> hi
>
> b) trap errors that would otherwise kill the program.
>
> In your case, you're killing your script anyways if the eval fails.
> So why not just do...
>
> print $stmt2;
> $csr2 = $dbh_prod->prepare($stmt2) or die
> $dbh_prod->trace(6),"\n\nCould not prepare statement:
> \n",$dbh_prod->errstr();
>
> Like I said, my perl experience is small, so I'm not sure if maybe
> the whole eval testing thing is taking up too much memory or what.
Probably not; eval{} is usually fairly lightweight.
I haven't looked up what value trace() returns, but it probably isn't
anything useful in the argument list of die().
More below.
> - -----Original Message-----
> From: Jibo John [mailto:jijohn@;cisco.com]
> Sent: Wednesday, November 13, 2002 3:31 PM
> To: [EMAIL PROTECTED]
> Subject: DBI giving unable to allocate memory error
> It gives the following error while preparing a select query:
> DBD::Oracle::db prepare failed: ORA-01062: unable to allocate memory for
> define buffer (DBD ERROR: OCIDefineByPos) at script.pl line 159.
>
> Here is the code snippet:
> print $stmt2;
> eval{
> $csr2 = $dbh_prod->prepare($stmt2);
> };
> if($@){
> $dbh_prod->trace(6);
> die "prepare failed : $DBI::errstr\n"
> }
>
> A 'select count(*)' of the same query $stmt2 runs without any issues.
>
> Here is the Oracle trace 6 output:
You need to turn on trace() _before_ the error occurs. The trace output
below just shows the DBI shutdown processing and tells us nothing about the
original error.
> DBI::db=HASH(0x208b10) trace level set to 6 in DBI 1.18-nothread
> Note: perl is running without the recommended perl -w option
> -> $DBI::errstr (&) FETCH from lasth=DBI::db=HASH(0x208b10)
Using -w in the #! line and 'use strict;' near the top of the program are
very useful for finding errors before they cause program failure.
> prepare failed : ORA-01062: unable to allocate memory for define
> buffer
> (DBD ERROR: OCIDefineByPos)
> -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x208b10)~INNER)
> Issuing rollback() for database handle being DESTROY'd without
> explicit
> disconnect() during global destruction.
> OCITransRollback(22d0e4,22d30c,0)=SUCCESS
> OCISessionEnd(22d0e4,22d30c,239724,0)=SUCCESS
> OCIServerDetach(22d150,22d30c,0)=SUCCESS
> OCIHandleFree(239724,9)=SUCCESS
> OCIHandleFree(22d150,8)=SUCCESS
> OCIHandleFree(22d0e4,3)=SUCCESS
> OCIHandleFree(22d30c,2)=SUCCESS
> <- DESTROY= undef during global destruction.
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.