Skip to content

Commit

Permalink
Fix case where a LOB is NULL and ora2pg reports error :
Browse files Browse the repository at this point in the history
    DBD::Oracle::db::ora_lob_read: locator is not of type OCILobLocatorPtr
LOB initialised with EMPTY_CLOB() are also exported as NULL intead of \\x
  • Loading branch information
darold committed Mar 13, 2016
1 parent e425a17 commit 8c6c840
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Ora2Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10291,7 +10291,7 @@ sub _extract_data
# Then foreach row use the returned lob locator to retrieve data
# and all column with a LOB data type, extract data by chunk
for (my $j = 0; $j <= $#$stt; $j++) {
if ($stt->[$j] =~ /LOB/) {
if (($stt->[$j] =~ /LOB/) && $row[$j]) {
my $lob_content = '';
my $offset = 1; # Offsets start at 1, not 0
if ( ($self->{parallel_tables} > 1) || (($self->{oracle_copies} > 1) && $self->{defined_pk}{"\L$table\E"}) ) {
Expand All @@ -10309,7 +10309,15 @@ sub _extract_data
$lob_content .= $lobdata;
}
}
$row[$j] = $lob_content;
if ($lob_content) {
$row[$j] = $lob_content;
} else {
$row[$j] = undef;
}
} elsif (($stt->[$j] =~ /LOB/) && !$row[$j]) {
# This might handle case where the LOB is NULL and might prevent error:
# DBD::Oracle::db::ora_lob_read: locator is not of type OCILobLocatorPtr
$row[$j] = undef;
}
}
push(@rows, [@row]);
Expand Down

0 comments on commit 8c6c840

Please sign in to comment.