I've got a table in oracle that has 12 fields.  4 of them our clobs and 4
are fields to track the size of the data in the clobs. 
I'm trying to update the clobs though and it errors out with:

update prod_copy set emi = ?,emi_length = ?,emi_title = ? where base_id =
?
1, EMI, { ora_type=>ORA_CLOB, ora_field=>'emi' }
2, 3
3, EMI_TITLE
4,12592 
DBD::Oracle::st execute failed:  (DBD ERROR: Can't match some parameters
to LOB fields in the table, check type and name) at
../blib/lib/SRS/DB/Product.pm line 82.

The sql looks fine, and I can't find details about this error.  I did find
some stuff in the POD that talks about needing to have the ora_field
added, and something about single row lob  updates being availble.

Any help?

Scott

::Code::
my $DB = new SRS::DB::Product();
$changes = {
    emi             => 'EMI',
    emi_title       => 'EMI_TITLE',
    };
$DB->update_copy_info_for_base_id(12592,$changes);

sub update_copy_info_for_base_id {
    my $self = shift;
    my $base_id = shift;
    my $changeref   = shift;
    my %changes     = %$changeref;
    my $clobs       = {
        emi             => 1
        };
    my @values; my @columns;
    foreach my $key (keys %changes) {
        if (defined($clobs->{$key})) {
          push @columns, $key;
          push @columns, $key . "_length";
          $changes{$key . "_length"} = length($changes{$key});
          } else {
          push @columns, $key;
        }
    }

    my $column      = join ' = ?,', @columns; $column         .= " = ?";
    my $sth = $SRS::DB::dbh->prepare(qq|update prod_copy set $column where
base_id = ?|);
    print qq|update prod_copy set $column where base_id = ?\n|;
    my $i = 1;
    foreach my $key (@columns) {
        if(defined($clobs->{$key})) {
            print qq|$i, $changes{$key}, { ora_type=>ORA_CLOB, ora_field=
>'$key' }\n|;
            $sth->bind_param($i, $changes{$key}, { ora_type=>ORA_CLOB,
ora_field=>'$key' });
          } else {
            print qq|$i, $changes{$key} \n|;
            $sth->bind_param($i, $changes{$key} );
        }

        ++$i;
    }
    print qq|$i,$base_id\n|;
    $sth->bind_param($i,$base_id);
    $sth->execute();
    $sth->finish();

}




Reply via email to