in reply to Re: Code useless, forget it... this is more usefull (o;
in thread prepare_cached for DBI::Oracle

  • How about using a LIMIT command ...
    unfortunately, LIMIT is not valid in ORACLE )o; and I call both of the one I detail about 80 000 times...
  • I tried to bind the values.. same problem...
    $sth_imei = $dbh->prepare_cached(<<__EOSQL__) or die "Couldn't parse q +uery:".$sth_imei->errstr; SELECT imei FROM imei_period WHERE (mobile_number = :mob) AND (account_no = :acc) __EOSQL__ $sth_imei->bind_param( ':mob', $rec[1] ); $sth_imei->bind_param( ':acc', $rec[0] ); $sth_imei->execute() or die "Couldn't execute query:" . $sth_imei- +>errstr; @imei = $sth_imei->fetchrow_array; print "IMEI : @imei\n";
    When executed, the $sth_imei->errstr does not return anything...
    I check, the SQL works and return the requested infor if executed in SQLPlus...

    This is very frustrating, especially since the $sth_acc one is working fine...
  • for $sth->finish() I thought I should not use it as it was cached ??
    But yes, I do not use it much...
  • Ihad the PrintError => 1, set, but not the RaiseError one.
    If I use RaiseError => 1 it doesnot change a thing )o; still no error reported...

    I will go for a perl -w I think... (o;
  • Replies are listed 'Best First'.
    Re: Re: Re: Code useless, forget it... this is more usefull (o;
    by Arguile (Hermit) on Jun 22, 2001 at 17:46 UTC
    Re: Re: Re: Code useless, forget it... this is more usefull (o;
    by Brovnik (Hermit) on Jun 22, 2001 at 18:39 UTC
      A couple more ideas (sparked by the 80,000) :
      1. Try binding the return values. e.g.
        my $imei; $rc = $sth_imei->bind_col(0,\$imei); $sth_imei->execute(); $sth_imei->fetch(); print "IMEI : $imei\n";
      2. If you don't want to do that, at least use ->fetchrow_arrayref(). Otherwise, each execute call has to create a new list for you. The _arrayref gives you a ref. to a static array, so less copying.
      3. bind_param should take a colum number shouldn't it, not a name, e.g. $sth_imei->bind_param(0,$rec[1])
      Either of the first 2 should save time, given 80,000 iterations.
      Finally, note that execute() can return '0E0' meaning 0 but true, meaning no rows (and different to undef for errors). May be worth checking for that explicitly.
      I think I'm out of ideas now...
      --
      Brovnik